Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
我没想法了~为什么错呢?#include<iostream> #include<math.h> using namespace std; int main() { int t, res, i, m, n, a; bool flag; scanf("%d",&t); while(t--) { m = 0; n = 0;flag = false; scanf("%d",&res); if(res % 2 == 1) flag = true; else{ for(i = 0; i < res; i++) { scanf("%d",&a); if(a == 0&&i % 2 == 1) m++; if(a == 0&&i % 2 == 0) n++; } if(fabs(m-n) < 2) flag = true; } if(flag) printf("YES\n"); else printf("NO\n"); } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator