Codeforces Round #237 Div.2 A
2014-05-11 16:07
274 查看
题目链接:http://codeforces.com/contest/404/problem/A
模拟题,第一次没有考虑对角线上的字符和其余地方的字符是相同的的情况,改掉后就OK了。
模拟题,第一次没有考虑对角线上的字符和其余地方的字符是相同的的情况,改掉后就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; }
相关文章推荐
- Topcoder SRM 565 Div.2
- codeforces Round # 187(Div.2) D
- CodeForces #194 Div.2 A. Candy Bags
- Codeforces Div.2 213 C Matrix (预处理+哈希)
- codeforces round #236 div.2 B
- codeforce 247 div.2 B
- UESTC 2014 Summer Training #6 Div.2
- Codeforces 453 B Little Pony and Harmony Chest(Round 259 div.1 B/div.2 D)
- cf Round#273 Div.2
- CodeForces Round #280 (Div.2)
- Codeforces Round #285(Div.2)
- Codeforces Round#289(DIV.2) + qualifying round for WCC
- #294 (div.2) D.A and B and Interesting Substring
- CodeForces Round #296 Div.2
- #298 (div.2) B. Covered Path
- #305 (div.2) D. Mike and Feet
- 【CF】196 Div.2 D. Book of Evil
- HDU 5364 Distribution money——BestCoder Round #50(div.2)
- BestCoder Round #50 (div.2)-----C The mook jong
- BestCoder Round #52 (div.2) 1001 Victor and Machine