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?In Reply To:为什么我的还是总WA? Posted by:jackie_wyx at 2007-03-11 12:41:33 > #include <stdio.h> > > main() > { > int t,n,k,i,max,sum; > int a[50002],b[50002],c[50002]; > > scanf("%d",&t); > for(k=1;k<=t;k++) > { > scanf("%d",&n); > max=0; > sum=0; > for(i=1;i<=n;i++) > { > scanf("%d",&a[i]); > sum+=a[i]; > if(sum<0) sum=0; > else if(sum>max) max=sum; > b[i]=max; > } > max=0; > sum=0; > for(i=n;i>=1;i--) > { > sum+=a[i]; > if(sum<0) sum=0; > else if(sum>max) max=sum; > c[i]=max; > } > max=0; > for(i=1;i<n;i++) > if(b[i]+c[i+1]>max) max=b[i]+c[i+1]; > printf("%d\n",max); > } > > return(0); > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator