Codeforces Round #157 (Div. 2) A. Little Elephant and Chess

题目:http://codeforces.com/contest/259/problem/A

判断一个棋盘经过行操作后能否成为一个正常的黑白相间的棋盘

思路:因为不涉及列操作 只要每行都是黑白相间就可以满足条件

#include <iostream>
#include <cstdlib>
using namespace std;

int a,b,n;
int main()
{
    bool ans=true;
    char start,previous,current;
    for(int i=0;i<8;i++)
    {
        cin >> current;
        start=previous=current;
        for(int j=0;j<6;j++)
        {
            cin>>current;
            if(current==previous)ans=0;
            previous=current;
        }
        cin>>current;
        if(current==previous||current==start) ans=0;
    }

    if(ans) cout << "YES"<<endl;
    else cout << "NO" <<endl;
return 0;
}

 

posted @ 2013-01-16 17:29  Daniel Qiu  阅读(155)  评论(0编辑  收藏  举报