QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#467057#1978. Stabbing NumbershizengjieWA 0ms3844kbC++14742b2024-07-08 13:26:472024-07-08 13:26:47

Judging History

你现在查看的是最新测评结果

  • [2024-07-08 13:26:47]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3844kb
  • [2024-07-08 13:26:47]
  • 提交

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
.....
.***.
.*.*.
.***.
.....
*///

Details

Tip: Click on the bar to expand more detailed information

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'