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<iostream> using namespace std; int main() { int n,a[100000],i,j; int he[100000],s,t,b; while(1) { s=0; cin>>n; if(n==0) break; j=0; he[0]=0; for(i=0;i<n;i++) { cin>>a[i]; if(a[i]<=0) { j++; he[j]=0; continue; } he[j]+=a[i]; } t=he[0]; for(i=0;i<=j;i++) { if(he[i]>t) { b=t; t=he[i]; //b=i; } } s+=t+b; cout<<s<<endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator