Pagini recente » Cod sursa (job #2583900) | Cod sursa (job #2532052) | Cod sursa (job #1684373) | Cod sursa (job #3280134) | Cod sursa (job #635699)
Cod sursa(job #635699)
Program zombie;
var n,k,i,j,cap:longint;
sum,d:int64;
a:array [1..1000000] of longint;
b1:array [1..1 shl 17] of char;
fi,fo:text;
begin
assign(fi,'zombie.in');
assign(fo,'zombie.out');
settextbuf(fi,b1);
reset(fi); rewrite(fo);
readln(fi,d,n,k); read(fi,cap); j:=1;
for i:=1 to n-1 do begin
read(fi,a[i]);
if (a[i]-cap>=n) or (i=n-1) then begin
if j>k then sum:=sum+k
else sum:=sum+j;
cap:=a[i];
j:=1;
end
else inc(j);
end;
write(fo,sum);
close(fo);
end.