This commit is contained in:
James 2020-03-15 09:19:27 +08:00
parent 27c9072f38
commit d299441efe
6 changed files with 81 additions and 8 deletions

View File

@ -1,5 +1,50 @@
#include<iostream>
#include <iostream>
using namespace std;
int main(){
bool a[51][51] = { 0 };
int bi(int x, int y)
{
a[x][y] = 1;
if (a[x - 1][y] == 0){
a[x-1][y]=1;
return 1;
}
if (a[x][y - 1] == 0){
a[x][y-1]=1;
return 1;
}
a[x][y] = 0;
return 0;
}
int main()
{
int m, n, k, ans = 0;
cin >> m >> n >> k;
for (int i = 1; i <= k; i++) {
int x, y;
cin >> x >> y;
a[x][y] = 1;
}
for (int i = 0; i <= n; i++) {
a[0][i] = 1;
}
for (int i = 1; i <= m; i++) {
a[i][0] = 1;
}
for (int i = 1; i <= m; i++) {
for (int j = 1; j <= n; j++) {
if (a[i][j] !=1) {
ans += bi(i, j);
}/*
cout<<ans<<endl;
for (int u = 0; u <= m; u++) {
for (int e = 0; e <= n; e++) {
cout << a[u][e] << " ";
}
cout << endl;
}
cout << endl
<< endl;*/
}
}
cout << ans;
}

BIN
2016_domino/domino.exe Normal file

Binary file not shown.

3
2016_domino/test/In0.txt Normal file
View File

@ -0,0 +1,3 @@
1 4
1
1 2

10
2016_domino/test/In1.txt Normal file
View File

@ -0,0 +1,10 @@
1 47
8
1 5
1 6
1 12
1 23
1 25
1 28
1 41
1 46

View File

@ -0,0 +1,4 @@
3 3
2
1 1
2 2

View File

@ -1,7 +1,18 @@
## z:\Chao\src\Template\test\in.txt
2020/03/14 ÖÜÁù 11:41:28.68
Hello Easy C++ project!
## z:\Chao\src\2016_domino\test\in.txt
2020-03-14 20:05:54.27
3
-----------------------------------------------
Process exited after 200 ms with return value 0
Process exited after 340 ms with return value 0
## z:\Chao\src\2016_domino\test\In0.txt
2020-03-14 20:05:54.27
1
-----------------------------------------------
Process exited after 230 ms with return value 0
## z:\Chao\src\2016_domino\test\In1.txt
2020-03-14 20:05:54.27
18
-----------------------------------------------
Process exited after 210 ms with return value 0