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 |
真的不知道哪里错,我拿别人ac的程序和我的做了整晚的随机测试,没找出一个不同的解,但我还是wa,我真的不知道哪里错,恳请管理员发那测试给我,和那个输出。我看了两天,还是找不了错,恳请管理员发那测试给我,和输出。或者举些易错的例子 让我死得心服口服 //#define debug 1 #include<stdio.h> #include<string.h> #include<stdlib.h> #include<string.h> #include<math.h> #define INF 30000 #define NMAX 540000 int a[7]; char f[NMAX]; int sum; int solve() { int i,k,t,last; int mid=sum/2; memset(f,0,sizeof(f)); f[0]=1; for(i=1;i<=a[1];i++) f[i]=1; if(f[mid]) return 1; for(i=2;i<=6;i++) { if(a[i]==0) continue; for(k=0;k<i;k++) { t=k; last=0; for(;;) { if(f[t]) last=a[i]; else { if(last>0) { f[t]=1; last--; } } t+=i; if(t>mid) break; } } if(f[mid]) return 1; } if(f[mid]) return 1; return 0; } int main() { #if _DEBUG freopen("in.txt","r",stdin); freopen("out.txt","w",stdout); #endif int i; int flag=0; int t=1; while(1) { flag=0; sum=0; for(i=1;i<=6;i++) { scanf("%d",&a[i]); sum+=a[i]*i; if(a[i]) flag=1; } if(flag==0) break; // if(t>1) // printf("\n"); printf("Collection #%d:\n",t++); if(sum%2) printf("Can't be divided.\n"); else if(solve()==0) printf("Can't be divided.\n"); else printf("Can't be divided.\n"); printf("\n"); } #if _DEBUG fclose(stdin); fclose(stdout); #endif return 1; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator