Codeforces Round #228 (Div. 2)B. Fox and Cross
来源:互联网 发布:wamp无法运行php 编辑:程序博客网 时间:2024/06/05 08:32
比赛时还看错题意了,以为还可以自己添加形成十字架;
#include <cstdio>#include <cstring>char stu[110][110];int n;int main(){ int i,j; while(~scanf("%d",&n)) { memset(stu,0,sizeof(stu)); getchar(); for(i=1;i<=n;++i) { for(j=1;j<=n;++j) { scanf("%c",&stu[i][j]); } getchar(); } if(stu[1][1]=='#'||stu[1][n]=='#'||stu[n][1]=='#'||stu[n][n]=='#') { printf("NO\n");continue; } for(i=1;i<=n;++i) { for(j=1;j<=n;++j) { if(stu[i][j]=='#') { if(i==1) { if(stu[i+1][j]=='#'&&stu[i+2][j]=='#'&&stu[i+1][j-1]=='#'&&stu[i+1][j+1]=='#') { stu[i][j]='k'; stu[i+1][j]='k'; stu[i+2][j]='k'; stu[i+1][j-1]='k'; stu[i+1][j+1]='k'; } } else if(i==n) { if(stu[i-1][j]=='#'&&stu[i-2][j]=='#'&&stu[i-1][j-1]=='#'&&stu[i-1][j+1]=='#') { stu[i][j]='k'; stu[i-1][j]='k'; stu[i-2][j]='k'; stu[i-1][j-1]='k'; stu[i-1][j+1]='k'; } } else if(j==1) { if(stu[i][j+1]=='#'&&stu[i][j+2]=='#'&&stu[i-1][j+1]=='#'&&stu[i+1][j+1]=='#') { stu[i][j]='k'; stu[i][j+1]='k'; stu[i][j+2]='k'; stu[i-1][j+1]='k'; stu[i+1][j+1]='k'; } } else if(j==n) { if(stu[i][j-1]=='#'&&stu[i][j-2]=='#'&&stu[i-1][j-1]=='#'&&stu[i+1][j-1]=='#') { stu[i][j]='k'; stu[i][j-1]='k'; stu[i][j-2]='k'; stu[i-1][j-1]='k'; stu[i+1][j-1]='k'; } } else { if(stu[i][j-1]=='#'&&stu[i][j+1]=='#'&&stu[i+1][j]=='#'&&stu[i-1][j]=='#') { stu[i][j]='k'; stu[i][j-1]='k'; stu[i][j+1]='k'; stu[i+1][j]='k'; stu[i-1][j]='k'; } } } } } for(i=1;i<=n;++i) { for(j=1;j<=n;++j) { if(stu[i][j]=='#') { printf("NO\n");goto loop; } } } printf("YES\n"); loop:; } return 0;}
0 0
- Codeforces Round #228 (Div. 2) B. Fox and Cross
- Codeforces Round #228 (Div. 2)B. Fox and Cross
- Codeforces Round #228 (Div. 2)B. Fox and Cross
- Codeforces Round #228 (Div. 2) B. Fox and Cross
- Codeforces Round #228 (Div. 2) B Fox and Cross(DFS)
- Codeforces Round #228 (Div. 1)-B-Fox and Minimal path
- Codeforces Round #228 (Div. 1) B. Fox and Minimal path
- Codeforces Round #290(Div.2) B.Fox And Two Dots
- B. Fox And Two Dots( Codeforces Round #290 (Div. 2))
- B. Fox And Two Dots Codeforces Round #290 (Div. 2)
- Codeforces Round #290 (Div. 2) B. Fox And Two Dots
- Codeforces Round #290 (Div. 2) B. Fox And Two Dots
- Codeforces Round #290 (Div. 2) B. Fox And Two Dots
- Codeforces Round #228 (Div. 2) A. Fox and Number Game
- Codeforces Round #228 (Div. 2)A.Fox and Number Game
- Codeforces Round #228 (Div. 2)C. Fox and Box Accumulation
- Codeforces Round #228 (Div. 2)A. Fox and Number Game
- Codeforces Round #228 (Div. 2)C. Fox and Box Accumulation
- 递推--01串
- Python系列视频教程: Django【13讲】第九讲 数据库使用多对一映射
- Codeforces Round #228 (Div. 2)A. Fox and Number Game
- OCP-1Z0-053-200题-154题-208
- C++实践之体会
- Codeforces Round #228 (Div. 2)B. Fox and Cross
- OCP-1Z0-053-200题-153题-211
- Android Http请求失败解决方法
- c++primer学习笔记4 - 表达式和语句
- OCP-1Z0-053-200题-152题-56
- Codeforces Round #228 (Div. 2)C. Fox and Box Accumulation
- 什么是编译器里的前端和后端
- usaco 1.2 Palindromic Squares(进制转化)
- OCP-1Z0-053-200题-151题-53