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 |
啊,WA了3次,终于AC了Source Code Problem: 1063 User: yzhw Memory: 264K Time: 0MS Language: GCC Result: Accepted Source Code # include <stdio.h> # include <stdbool.h> bool data[31]; int num; int chk() { int n=0,i; for(i=1;i<=num;i++) if(data[i]) n++; for(i=1;i<=n;i++) { if(data[i]) continue; else { int j; for(j=i+2;j<=num;j+=2) if(data[j]) break; if(j>num) return 0; else data[j]=0; } } return 1; } int main() { int casenum,i; scanf("%d",&casenum); for(i=1;i<=casenum;i++) { int j; scanf("%d",&num); for(j=1;j<=num;j++) scanf("%d",data+j); if(num%2==1||chk()) 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