Pagini recente » Diferente pentru happy-coding-2007 intre reviziile 10 si 25 | Diferente pentru happy-coding-2007 intre reviziile 1 si 25 | Diferente pentru happy-coding-2007 intre reviziile 11 si 25 | Borderou de evaluare (job #2975975) | Cod sursa (job #1479755)
# include <fstream>
using namespace std;
ifstream fin("ssm.in");
ofstream fout("ssm.out");
long long s,maxim,x,i,n,a,b,bmax, amax;
int main () {
fin>>n;
for(i=1;i<=n;i++){
fin>>x;
if(s+x>=x)
s=s+x;
else{
s=x;
a=i;
}
if(s>maxim){
maxim=s;
bmax = i;
amax = a;
}
}
fout<<maxim<<" "<<amax<<" "<<bmax;
return 0;
}