hdu 2509 博弈

来源:互联网 发布:无锡市网络作家协会 编辑:程序博客网 时间:2024/05/16 01:03

AC代码如下:

#include <iostream>#include <cstdio>using namespace std;int main(){int T, N, s, cnt, temp;while( scanf( "%d", &N ) != EOF ){s = cnt = 0;while( N-- ){cin >> temp;s ^= temp;cnt += ( temp > 1 ? 1 : 0 );}if( ( s == 0 && cnt >= 2 ) || s != 0 && cnt == 0 ){cout << "No" << endl;}else{cout << "Yes" << endl; }}return 0;}