11520 - Fill the Square (水题)
来源:互联网 发布:java pagecache 编辑:程序博客网 时间:2024/05/16 07:05
水题,要求字典序,只要从上往下,从左往右,字母从A到Z,能放的放上就行了
#include <cstdio>#include <algorithm>using namespace std;int main(){ int i,j; char mmm[11][11]; int T; int n; scanf("%d",&T); int ccc=1; while(T--){ scanf("%d",&n); for(i=0;i<n;i++){ scanf("%s",mmm[i]); } char k; for(j=0;j<n;j++){ for(i=0;i<n;i++){ if(mmm[i][j]=='.'){ for(k='A';k<='Z';k++){ if(i-1>=0){ if(mmm[i-1][j]==k) continue; } if(i+1<n){ if(mmm[i+1][j]==k) continue; } if(j-1>=0){ if(mmm[i][j-1]==k) continue; } if(j+1<n){ if(mmm[i][j+1]==k) continue; } mmm[i][j]=k; break; } } } } printf("Case %d:\n",ccc++); for(i=0;i<n;i++){ for(j=0;j<n;j++){ printf("%c",mmm[i][j]); } printf("\n"); } } return 0;}
0 0
- 11520 - Fill the Square (水题)
- 11520 - Fill the Square
- 11520 - Fill the Square
- 11520 - Fill the Square
- UVA 11520 - Fill the Square
- uva 11520 - Fill the Square
- uva 11520 Fill the Square
- Uva-11520-Fill the Square
- uva 11520 - Fill the Square
- UVA 11520 Fill the Square
- UVA 11520Fill the Square
- UVA 11520 Fill the Square
- UVA - 11520 Fill the Square
- Uva 11520 - Fill the Square
- UVA 11520 Fill the Square
- UVa 11520 - Fill the Square
- UVA 11520 Fill the Square
- UVa 11520 - Fill the Square
- Bean销毁之前的行为
- 杂记 III
- sqlite嵌入式移植评估
- 【Hibernate学习笔记】与触发器协同工作
- C#-面向对象思想-类-Car---ShinePans
- 11520 - Fill the Square (水题)
- 一定要坚持下去 IOS
- ubuntu12.04下redis安装/配置
- ASP.NET 三层架构设计
- initgraph函数(讲解)
- 华为编程-删除字符串中与前面重复的字符串
- 【柱形图】Trapping Rain Water
- CDOJ_149 解救小Q
- Hadoop日志到底存在哪里?