QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#467057 | #1978. Stabbing Number | shizengjie | WA | 0ms | 3844kb | C++14 | 742b | 2024-07-08 13:26:47 | 2024-07-08 13:26:47 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=40;
char a[N][N];
int main(){
// freopen("matrix.in","r",stdin);
// freopen("matrix.out","w",stdout);
int n,m;
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
scanf(" %c",&a[i][j]);
}
}
int cnt=0;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(a[i][j]=='*'){
if(a[i-1][j]=='*'&&a[i][j+1]=='*'){
cnt++;
}
if(a[i+1][j]=='*'&&a[i][j+1]=='*'){
cnt++;
}
if(a[i][j-1]=='*'&&a[i+1][j]=='*'){
cnt++;
}
if(a[i][j-1]=='*'&&a[i-1][j]=='*'){
cnt++;
}
}
}
}
if(cnt==4)printf("1");
else printf("2");
return 0;
}
/*
5 5
.....
.***.
.*.*.
.***.
.....
*///
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3844kb
input:
10 13 .....****.... .....*..*.... .....*..***.. .....*....*.. .....*....*** ...***......* ...*........* ****........* *...........* *************
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
8 15 ............... .........*****. ....***..*...*. ....*.*..*...*. .****.****...*. .*...........*. .*************. ...............
output:
2
result:
ok single line: '2'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3836kb
input:
16 25 ...............********** ...............*........* ............****........* ............*...........* ..........***...........* ..........*.............* ........***.............* ........*...............* .....****...............* .....*..................* .....*..................* ...***.....
output:
2
result:
wrong answer 1st lines differ - expected: '3', found: '2'