Codeforces Round #237 Div.2 A
来源:互联网 发布:几比几的比例怎么算法 编辑:程序博客网 时间:2024/05/16 00:58
题目链接:http://codeforces.com/contest/404/problem/A
模拟题,第一次没有考虑对角线上的字符和其余地方的字符是相同的的情况,改掉后就OK了。
///2014.3.19///Codeforces Round #237 Div.2///A#include <iostream>#include <cstdio>using namespace std;char table[310][310];int main(){ // freopen("in","r",stdin); // freopen("out","w",stdout); int n; cin>>n; char a,b; for(int i=1 ; i<=n ; i++){ for(int j=1 ; j<=n ; j++){ cin>>table[i][j]; } } a = table[1][1]; b = table[1][2]; bool is = true; if( a==b ) is = false; for(int i=1 ; i<=n ; i++){ if( !is ) break; for(int j=1 ; j<=n ; j++){ if( i==j || i+j==n+1 ){ if( table[i][j]!=a ){ is = false; break; } } else{ if( table[i][j]!=b ){ is = false; break; } } } } if( is ) cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0;}
0 0
- Codeforces Round #237 (Div. 2) A & B
- Codeforces Round #237 (Div. 2) A~D
- Codeforces Round #237 Div.2 A
- Codeforces Round #147 (Div. 2) / 237A Free Cash (模拟)
- Codeforces Round #237 (Div. 2) A. Valera and X
- Codeforces Round #131 (Div. 2) A B
- Codeforces Round #174 (Div. 2) Problem A
- Codeforces Round #173 (Div. 2) A.Bit++
- Codeforces Round #181 (Div. 2) A题
- Codeforces Round #184 (Div. 2) A题
- Codeforces Round #185 (Div. 2)--A,B
- Codeforces Round #172 (Div. 2) A题
- Codeforces Round #166 (Div. 2) A题
- Codeforces Round #132 (Div. 2) A题
- Codeforces Round #131 (Div. 2) A题
- Codeforces Round #133 (Div. 2) A题
- Codeforces Round #137 (Div. 2) A题
- Codeforces Round #138 (Div. 2) A题
- [LeetCode] Swap Nodes in Pairs
- 【菜鸟学WCF】Wcf消息交换模式
- codeforces round #236 div.2 C
- apue.h包头找不到的问题
- mysql乱码问题
- Codeforces Round #237 Div.2 A
- OCP 1Z0 051 12
- Hibernate Annotation(注解)
- JQuery中2个等号与3个等号的区别
- 【Android数据存储】- File
- UML的关系
- Codeforces Round #237 Div.2 B
- UItabelView-实例化一个表格视图
- iftop和iostat安装和简单使用