ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1296. Hyperjump

This is my AC program
Posted by michalos2005 14 Mar 2007 02:23
if you cannot solve this problem I give you my solution. The solution is simple:)
#include <iostream>
using namespace std;
int main()
{
 int a;
 int n;
cin>>n;
int sum=0;
int max1=0;
 while (n--){
  cin>>a;
   sum+=a;
  if (sum<0)
   sum=0;
  max1=max(sum,max1);

  }
cout<<max1<<endl;

}
ths!!
Posted by Bobur 22 Oct 2008 00:05
i can't solve this prblm with O(N)!! thank you!