Pagini recente » Cod sursa (job #2977462) | Cod sursa (job #2179915) | Cod sursa (job #1638076) | Cod sursa (job #260433) | Cod sursa (job #280333)
Cod sursa(job #280333)
#include <stdio.h>
void calcul()
{
long n,x,sc=0,smax=-1000000000,stc=1,drc,stmax,drmax;
scanf ("%ld",&n);
for (long i = 1; i <= n; ++i)
{
scanf ("%ld",&x);
sc += x;
if (sc > smax)
{
smax = sc;
stmax = stc;
drmax = drc;
}
if (sc < 0)
{
sc = 0;
stc = drc + 1;
}
}
printf("%ld%ld%ld",smax,stmax,drmax);
}
int main()
{
freopen ("ssp.in","r",stdin);
freopen ("ssp.out","w",stdout);
calcul();
return 0;
}