Pagini recente » Cod sursa (job #327687) | Cod sursa (job #1853023) | Cod sursa (job #2889823) | Cod sursa (job #2546293) | Cod sursa (job #247194)
Cod sursa(job #247194)
var i,p,j,jjj,jj:integer; nr2,nr5:byte;
f:text;
begin
assign (f,'fact.in');
reset (f);
readln (f,p);
close (f);
if p=0 then
begin
assign (f,'fact.out');
rewrite (f);
writeln (f,1);
close(f);
end
else
begin
i:=5;
while nr5<>p do
begin
nr2:=0; nr5:=0;
for j:=1 to i do
begin
jj:=j; jjj:=j;
while (jj<>0) and (jjj<>0) do
begin
if jj mod 2=0 then
inc(nr2);
jj:=jj div 2;
if jjj mod 5=0 then
inc (nr5);
jjj:=jjj div 5;
end;
end;
inc (i);
end;
if nr5=p then
begin
assign (f,'fact.out');
rewrite (f);
writeln (f,i-1);
close(f);
end;
end;
end.