Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为什莫错误阿

Posted by ch_619999 at 2007-09-26 09:05:02 on Problem 2593
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator