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"stdio.h" #include"string.h" int f[30],now[30],de[30],fee[30]; int t[30],r[30],max,v,n,sum,u,left; void main() { int i,ii,jj; int ho,mi; while(scanf("%d",&n),n) { scanf("%d",&ho); u=-1; mi=60*ho; for(i=1;i<=n;i++) scanf("%d",&f[i]); for(i=1;i<=n;i++) scanf("%d",&de[i]); for(i=1;i<=n-1;i++) scanf("%d",&fee[i]); memset(t,0,sizeof(t)); for(i=1;i<=n;i++) now[i]=f[i]; ii=0; sum=0; while(ii<=n-1) { left=mi; for(i=1;i<=ii;i++) left-=5*fee[i]; // printf("%d ",left); if(left<5) break; while(1) { jj=1; max=0; for(i=1;i<=ii+1;i++) { if(now[i]>max) {max=now[i];jj=i;} } sum+=now[jj]; //printf("a%d ",now[jj]); now[jj]-=de[jj]; if(now[jj]<0) now[jj]=0; t[jj]+=5; left-=5; if(left<5) { if(sum>u) { u=sum; for(i=1;i<=n;i++) {r[i]=t[i];now[i]=f[i];} memset(t,0,sizeof(t)); } sum=0; break; } } ii++; } printf("%d",r[1]); for(i=2;i<=n;i++) printf(", %d",r[i]); printf("\nNumber of fish expected: %d\n\n",u); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator