Pagini recente » Cod sursa (job #1880868) | Cod sursa (job #1366224) | Cod sursa (job #470087) | Cod sursa (job #1646705) | Cod sursa (job #363041)
Cod sursa(job #363041)
const vek:array[1..12] of longint = (25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625, 48828125, 244140625, 1220703125);
var f:text;
p,n,i,h,j:longint;
begin
assign(f,'fact.in');
reset(f);
readln(f,p);
close(f);
i:=0;
if p=0 then n:=1 else
n:=0;
h:=1;
j:=1;
while i<p do begin
n:=n+5;
inc(i);
if (n>=vek[j]) and (j<=12) then begin
i:=i+n div vek[j];
inc(j);
end;
end;
assign(f,'fact.out');
rewrite(f);
writeln(f,n);
close(f);
end.