标签:
题目链接: http://acm.split.hdu.edu.cn/showproblem.php?pid=4994
#include <cstdio> #include <cstring> #include <iostream> #include <cmath> #include<vector> #include<queue> #include<algorithm> using namespace std; typedef long long LL; const int maxn=500009; const int INF=0x3f3f3f3f; const int mod=2009; int main() { int T; scanf("%d", &T); while(T--) { int n, num; scanf("%d", &n); int sign=0; for(int i=1; i<=n; i++) { scanf("%d", &num); if(num!=1 && !sign) sign=i; } ///!sign&&n%2判断如果每一堆都是1,n为奇数赢 ///sign&&(sign-1)%2==0开头连续个1的个数是偶数才会赢,同时也包括没有1的情况 if((!sign&&n%2) || (sign&&(sign-1)%2==0)) puts("Yes"); else puts("No"); } return 0; }
标签:
原文地址:http://www.cnblogs.com/w-y-1/p/5796364.html