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:我二进制压缩物品的数组开小了为什么报WA而不是RE啊?In Reply To:Re:我二进制压缩物品的数组开小了为什么报WA而不是RE啊? Posted by:guodongshan at 2010-08-15 10:18:54 > 我也是这样 为什么呢?难道不能用二进制压缩了? > #include<stdio.h> > #include<string.h> > int Ma(int a,int b) > { > return a>b?a:b; > } > int main() > { > int i,j,k,cas=1,num,sum,ave; > int ans[210003],bag[93]; > while(1) > { > k=0; sum=0; > for(i=1;i<=6;i++) > { > scanf("%d",&num); > sum+=num*i; > for(j=1;j<=num;j*=2) > bag[k++]=j*i; > } > if(sum==0) > break; > printf("Collection #%d:\n",cas++); > if(sum%2) > puts("Can't be divided."); > else{ > ave=sum/2; > memset(ans,0,sizeof(ans)); > for(i=0;i<k;i++) > { > for(j=ave;j>=bag[i];j--) > ans[j]=Ma(ans[j],ans[j-bag[i]]+bag[i]); > } > //printf("%d\n",ans[ave]); > if(ans[ave]==ave) > puts("Can be divided."); > else > puts("Can't be divided."); > } > puts(""); > } > return 0; > } > > 哪里错了? Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator