80分 两个WA 求助
查看原帖
80分 两个WA 求助
1465737
FOOLYCL楼主2024/12/18 20:39
#include<stdio.h>
int main()
{
	int a,b,cnt=0,cot=0;
	scanf("%d%d",&a,&b);
	char str[a+5][b+5];
	
	for(int i=0;i<a+5;i++)
	{
		for(int j=0;j<b+5;j++)
		{
			str[i][j]='?';
		}
	}
	for(int i=3;i<a+3;i++)
	{
		for(int j=3;j<b+3;j++)
		{
			scanf(" %c",&str[i][j]);
			if(str[i][j]=='*')
			{
				cnt++;
			}
			if(str[i][j]=='$')
			{
				cot++;
			}
		}
	}
	
	for(int i=3;i<a+3;i++)
	{
		for(int j=3;j<b+3;j++)
		{
			if(str[i][j]=='*'&&str[i-2][j]=='*'&&str[i-1][j]=='*'&&str[i+1][j]=='*'&&str[i+2][j]=='*')
			{
				printf("Pleasing!");
				return 0;
			}
			if(str[i][j]=='*'&&str[i][j-2]=='*'&&str[i][j-1]=='*'&&str[i][j+1]=='*'&&str[i][j+2]=='*')
			{
				printf("Pleasing!");
				return 0;
			}
			if(str[i][j]=='*'&&str[i-2][j-2]=='*'&&str[i-1][j-1]=='*'&&str[i+1][j+1]=='*'&&str[i+2][j+2]=='*')
			{
				printf("Pleasing!");
				return 0;
			}
			if(str[i][j]=='*'&&str[i-2][j+2]=='*'&&str[i-1][j+1]=='*'&&str[i+1][j-1]=='*'&&str[i+2][j-2]=='*')
			{
				printf("Pleasing!");
				return 0;
			}
			if(str[i][j]=='$'&&str[i-2][j]=='$'&&str[i-1][j]=='$'&&str[i+1][j]=='$'&&str[i+2][j]=='$')
			{
				printf("zylwins!");
				return 0;
			}
			if(str[i][j]=='$'&&str[i][j-2]=='$'&&str[i][j-1]=='$'&&str[i][j+1]=='$'&&str[i][j+2]=='$')
			{
				printf("zylwins!");
				return 0;
			}
			if(str[i][j]=='$'&&str[i-2][j-2]=='$'&&str[i-1][j-1]=='$'&&str[i+1][j+1]=='$'&&str[i+2][j+2]=='$')
			{
				printf("zylwins!");
				return 0;
			}
			if(str[i][j]=='$'&&str[i-2][j+2]=='$'&&str[i-1][j+1]=='$'&&str[i+1][j-1]=='$'&&str[i+2][j-2]=='$')
			{
				printf("zylwins!");
				return 0;
			}
			
		}
	}
	
	if(cnt>cot)
	{
		printf("Z");
	}
	if(cnt<cot)
	{
		printf("W");
	}
}
2024/12/18 20:39
加载中...