本文主要是介绍CF228B题Fox and Cross,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
#include <stdio.h>
#include <string.h>
char s[101][101];
int main()
{int n, i, j, x=0;scanf("%d",&n);for(i=0;i<n;i++){scanf(" %s",s[i]);}for(i=1;i<n-1;i++){for(j=1;j<n-1;j++){if(s[i][j]=='#'&&s[i-1][j]=='#'&&s[i+1][j]=='#'&&s[i][j-1]=='#'&&s[i][j+1]=='#'){s[i][j]='.';s[i-1][j]='.';s[i+1][j]='.';s[i][j-1]='.';s[i][j+1]='.';}}}for(i=0;i<n;i++){for(j=0;j<n;j++){if(s[i][j]=='#'){x=1;break;}}if(x)break;}if(x)printf("NO\n");elseprintf("YES\n");return 0;
}
这篇关于CF228B题Fox and Cross的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!