Cod sursa(job #225728)

Utilizator ildikoprecupPrecup Ildiko ildikoprecup Data 30 noiembrie 2008 19:59:06
Problema Factorial Scor 15
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.43 kb
var p,c,d,i,ii:longint;
f:text;
begin
assign (f,'fact.in');
reset(f);
read(f,p);
i:=0;d:=0;c:=0;
repeat
inc(i);
ii:=i;
repeat
if (ii mod 2=0)  and (ii<>0) then begin  inc(d); ii:=ii div 2; end;
until (ii mod 2<>0) or (ii=0);
repeat
if (ii mod 5=0) and (ii<>0) then begin  inc(c); ii:=ii div 5; end;
until (ii mod 5<>0) or (ii=0);
until (d>=p) and (c>=p);
assign(f,'fact.out');
rewrite(f);
write(f,i);
close(f);
end.