Pagini recente » Cod sursa (job #2669325) | Diferente pentru documentatie/wiki intre reviziile 11 si 12 | Cod sursa (job #499297) | Cod sursa (job #1944881) | Cod sursa (job #3159410)
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
ifstream fin("ssm.in");
ofstream fout("ssm.out");
int main()
{
int n;
fin>>n;
long long maxit=-int(2e9),maxi=-int(2e9);
for(int i=1;i<=n;++i){
long long s;
fin>>s;
maxi=max(s,maxi+s);
if(maxi>maxit){
maxit=maxi;
}
}
cout<<maxit;
return 0;
}