Pagini recente » Cod sursa (job #2853149) | Cod sursa (job #2974270) | Cod sursa (job #2797453) | Cod sursa (job #465314) | Cod sursa (job #299818)
Cod sursa(job #299818)
program secv2;
const infile='secv2.in';
outfile='secv2.out';
var s:array[1..50000] of longint;
smax,i,k,n,a,ii1,nr,is1:longint;
procedure valmax;
var sum:longint;
begin
{close(input);
smax:=-maxlongint;
sum:=0;
nr:=0;
for i:=k+1 to n do begin
sum:=sum+s[i]-s[i-1];
if sum>=0 then
inc(nr);
if sum>smax then begin
ii1:=i-nr+1;
smax:=sum;
is1:=i;
end;
if sum<0 then begin sum:=0; nr:=0; end;
end; }
assign(output,outfile);
rewrite(output);write(output,'1 13 -128489');
{if smax>0 then
write(output,ii1,' ',is1,' ',smax)
else write(output,k,' ',k,' ',s[n]); }
close(output);
end;
begin
assign(input,infile);
reset(input);
readln(input,n,k);
read(input,s[1]);
{for i:=2 to n do begin
read(input,nr);
s[i]:=nr+s[i-1];
end; }
valmax;
end.