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 |
Re:请教诸位,哪里错了In Reply To:Re:请教诸位,哪里错了 Posted by:c0053 at 2006-05-21 15:50:18 #include <stdio.h> int main() { int num,t,i,z,j,o; int a[35]; // freopen("in.txt","r",stdin); scanf("%d",&t); for(z=0;z<t;z++) { j=o=0; scanf("%d",&num); if(num%2==1) { printf("YES\n"); for(i=1;i<=num;i++) //你错是因为 少了这一步 scanf("%d",&j); continue; } for(i=0;i<num;i++) { scanf("%d",&a[i]); if(a[i]==1) { if((i+1)%2==1) j++; else o++; } } if(j-o<=1&&j-o>=-1) 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