Pagini recente » Cod sursa (job #3301151) | Cod sursa (job #1012264) | Istoria paginii runda/14_martie_simulare_oji_2024_clasa_10 | Cod sursa (job #2242843) | Cod sursa (job #1256278)
#include<fstream>
using namespace std;
ifstream fin("ssm.in");
ofstream fout("ssm.out");
int n,j,ima,jma,maxim,i,im,s;
int v;
int main(){
fin>>n;
for(i=1;i<=n;i++){
fin>>v;
s+=v;
if(s<v){
s=v;
im=i;
}
if(maxim<s){
maxim=s;
ima=im;
jma=i;
}
else{
if(maxim==0){
maxim=s;
ima=im;
jma=i;
}
}
}
fout<<maxim<<" "<<ima<<" "<<jma;
return 0;
}