Pagini recente » Cod sursa (job #2013586) | Cod sursa (job #72041) | Cod sursa (job #2758196) | Cod sursa (job #2400079) | Cod sursa (job #203820)
Cod sursa(job #203820)
program Fact;
var
p : longint;
n, i, j, k : longint;
fl : text;
function citzero(l:longint):longint;
var
c1, c2 : longint;
begin
citzero := 0;
c1 := l;
while c1 > 0 do
begin
c2 := c1;
while (c2 div 5 >= 1) do
begin
c2 := c2 div 5;
inc(citzero);
end;
c1 := c1-5;
end;
end;
procedure cautabin(in1,in2:longint);
var
x, z : longint;
begin
x := (in1+in2) div 2;
z := citzero(x);
if z = p then
begin
x := x - (x mod 5);
writeln(x);
halt;
end
else
if z > p then
cautabin(1,in1-1)
else
cautabin(in1+1,in2);
end;
begin
assign(fl,'fact.in');
reset(fl);
readln(fl,p);
close(fl);
assign(fl,'fact.out');
rewrite(fl);
cautabin(1,10000000);
close(fl);
end.