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 |
汗~少了一个空行,PE了一次。留码参考#include"stdio.h" void main() { int a[25],b[25]; int i,n,m,max,c,sum,t=1,l; while(scanf("%d%d%d",&n,&m,&c)!=EOF) { if(n==0&&m==0&&c==0)break; sum=0; max=0; for(i=1;i<=25;i++) b[i]=0; for(i=1;i<=n;i++) scanf("%d",&a[i]); while(m--) { scanf("%d",&l); if(b[l]==0) { b[l]=1; sum+=a[l]; if(max<sum)max=sum; } else if(b[l]=1) { b[l]=0; sum-=a[l]; } } printf("Sequence %d\n",t++); if(sum>c) printf("Fuse was blown.\n\n"); if(sum<=c) printf("Fuse was not blown.\nMaximal power consumption was %d amperes.\n\n",max); } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator