Pagini recente » Cod sursa (job #240798) | Cod sursa (job #741446) | Cod sursa (job #976891) | Cod sursa (job #1029896) | Cod sursa (job #1645385)
#include <cstdio>
using namespace std;
int n,x,best[6000005],i,in,sf,inmax,max1;
int main()
{
freopen("ssm.in","r",stdin);
freopen("ssm.out","w",stdout);
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&best[i]);
if(best[i]+best[i-1]>best[i])
best[i]=best[i]+best[i-1];
else
if(i-1!=0)
if(best[i]>best[i-1]+best[i])
in=i;
else
if(best[i]==best[i-1]+best[i])
in=i;
if(best[i]>max1)
{
max1=best[i];
inmax=in;
sf=i;
}
}
printf("%d %d %d",max1,inmax,sf);
return 0;
}