Cod sursa(job #134319)

Utilizator ghitza_2000Stefan Gheorghe ghitza_2000 Data 11 februarie 2008 13:01:18
Problema Factorial Scor 15
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.38 kb
var i,p,n,ct,ct1,ct2,d:longint;
    f,g:text;
begin
assign(f,'fact.in'); reset(f);
assign(g,'fact.out'); rewrite(g);
readln(f,p); ct:=0; n:=1;
while ct<p do
begin
n:=n+1;
d:=n;
while (d mod 2)=0  do
begin
inc(ct1);
d:=d div 2;
 end;
while (d mod 5)=0 do
begin
inc(ct2);
d:=d div 5;
end;
if ct1>ct2 then ct:=ct2
else ct:=ct1;
end;
write(g,n);
close(f); close(g);
end.