Bạn có thể nói rõ hơn không?
const fi='tongmax.inp';
fo='tongmax.out';
var a:array[1..100]of integer;
n,m,i,j,k:byte;
s,max:integer;
f1,f2:text;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n,m);
for i:=1 to n do
begin
read(f1,a[i]);
end;
{---------------xuat--------------------}
for i:=1 to n do write(f2,a[i]:4);
{---------------------------------------}
writeln(f2);
k:=1;
max:=0;
for i:=1 to m do max:=max+a[i];
for i:=2 to n-m+1 do
begin
s:=0;
for j:=i to i+m-1 do
s:=s+a[j];
if s>max then begin
max:=s;
k:=i;
end;
end;
writeln(f2,'day con co tong lon nhat la: ');
for i:=k to k+m-1 do write(f2,a[i]:4);
close(f1);
close(f2);
end.
const fi='tongmax.inp';
fo='tongmax.out';
var a:array[1..100]of integer;
n,m,i,j,k:byte;
s,max:integer;
f1,f2:text;
begin
assign(f1,fi); reset(f1);
assign(f2,fo); rewrite(f2);
readln(f1,n,m);
for i:=1 to n do
begin
read(f1,a[i]);
end;
{---------------xuat--------------------}
for i:=1 to n do write(f2,a[i]:4);
{---------------------------------------}
writeln(f2);
k:=1;
max:=0;
for i:=1 to m do max:=max+a[i];
for i:=2 to n-m+1 do
begin
s:=0;
for j:=i to i+m-1 do
s:=s+a[j];
if s>max then begin
max:=s;
k:=i;
end;
end;
writeln(f2,'day con co tong lon nhat la: ');
for i:=k to k+m-1 do write(f2,a[i]:4);
close(f1);
close(f2);
end.