Pagini recente » Clasament Teme ACM Unibuc 2013 | Cod sursa (job #2539198) | Cod sursa (job #262706) | Cod sursa (job #523458) | Cod sursa (job #701889)
Cod sursa(job #701889)
program xxx;
var f,g:text;
smax,i,j,n,s,k,pozi,pozj,u:integer;
v:array [1..100] of integer;
su: array [0..100] of integer;
begin
assign (f,'ssm.in');
reset (f);
assign (g,'ssm.out');
rewrite (g);
read (f,n); j:=2;
For i:=1 to n do
begin
read (f,v[i]);
su[i]:=su[i-1]+v[i];
end;
for i:=1 to n-1 do
begin
For j:=i+1 to n do
Begin
S:=su[j]-su[i-1];
If s>smax then
Begin
Smax:=s;
Pozi:=I;
Pozj:=j;
End;
End;
end;
write (g,smax,' ',pozi,' ',pozj);
close (f);
close (g);
end.