ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#195885 | #3419. 方格判定 | Ethan_Lin | 100 | 67ms | 5188kb | C++ | 1.2kb | 2023-10-18 21:14:46 | 2023-10-18 22:44:47 |
answer
#include <bits/stdc++.h>
using namespace std;
int n,m,a[1005][1005],black,hole,c,s;
char ccc;
bool chk(int x,int y){
if(!(x>=1 && x+5<=n && y>=1 && y+5<=m)) return false;
return a[x][y] && a[x][y+1] && a[x][y+2] && a[x][y+3] && a[x][y+4] && a[x][y+5]
&& a[x+1][y] && a[x+1][y+1] && !a[x+1][y+2] && !a[x+1][y+3] && a[x+1][y+4] && a[x+1][y+5]
&& a[x+2][y] && !a[x+2][y+1] && !a[x+2][y+2] && !a[x+2][y+3] && !a[x+2][y+4] && a[x+2][y+5]
&& a[x+3][y] && !a[x+3][y+1] && !a[x+3][y+2] && !a[x+3][y+3] && !a[x+3][y+4] && a[x+3][y+5]
&& a[x+4][y] && a[x+4][y+1] && !a[x+4][y+2] && !a[x+4][y+3] && a[x+4][y+4] && a[x+4][y+5]
&& a[x+5][y] && a[x+5][y+1] && a[x+5][y+2] && a[x+5][y+3] && a[x+5][y+4] && a[x+5][y+5];
}
int main(){
std::ios::sync_with_stdio(false);
cin>>n>>m;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>ccc;
if(ccc=='#') a[i][j]=1;
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(a[i][j]==1) black++;
if(chk(i,j)==true) hole++;
}
}
// cout<<hole<<" "<<black<<endl;
c=(hole*100-black)/(200-146);
s=(black-146*c)/100;
cout<<c<<" "<<s;
return 0;
}
// 146c+100s=black
// 2c+100=hole
// 200c+100s=100hole
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1320kb
input:
17 17 ......##########. ......##########. ......##########. ......####..####. ......###....###. .......
output:
1 0
result:
ok single line: '1 0'
Test #2:
score: 10
Accepted
time: 0ms
memory: 1312kb
input:
17 17 ...........###... ...........###... ...........###... ...........###... ....##########... .......
output:
0 1
result:
ok single line: '0 1'
Test #3:
score: 10
Accepted
time: 0ms
memory: 1292kb
input:
17 17 ................. ................. ................. ................. .##############.. .###...
output:
0 1
result:
ok single line: '0 1'
Test #4:
score: 10
Accepted
time: 0ms
memory: 1444kb
input:
50 50 ##########...................##############....### ##########...................##############...
output:
1 11
result:
ok single line: '1 11'
Test #5:
score: 10
Accepted
time: 0ms
memory: 1456kb
input:
50 50 ......................###......................... ......................###.....................
output:
5 5
result:
ok single line: '5 5'
Test #6:
score: 10
Accepted
time: 0ms
memory: 1448kb
input:
50 50 ......##########.................................. ......##########.......####################...
output:
7 2
result:
ok single line: '7 2'
Test #7:
score: 10
Accepted
time: 25ms
memory: 4940kb
input:
1000 1000 ##########..##########..##########..##########..##########..##########..##########..######...
output:
4316 0
result:
ok single line: '4316 0'
Test #8:
score: 10
Accepted
time: 14ms
memory: 5188kb
input:
1000 1000 .............................................................................................
output:
539 235
result:
ok single line: '539 235'
Test #9:
score: 10
Accepted
time: 15ms
memory: 1764kb
input:
1000 1000 .............................................................................................
output:
3 7
result:
ok single line: '3 7'
Test #10:
score: 10
Accepted
time: 13ms
memory: 1792kb
input:
1000 1000 .............................................................................................
output:
9 1
result:
ok single line: '9 1'
Extra Test:
score: 0
Extra Test Passed