Cod sursa(job #302132)

Utilizator theocmtAxenie Theodor theocmt Data 8 aprilie 2009 17:51:51
Problema Factorial Scor 10
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.44 kb
var i,n,p,cz,f:longint;
    g,h:text;
begin
assign(g,'fact.in');
assign(h,'fact.out');
reset(g); rewrite(h);
read(g,p);
f:=1;
for i:=1 to MaxLongInt do
    begin
    f:=f*i;
    if (f mod 10=0) then
       begin
       inc(cz);
       f:=f div 10;
       end;
    f:=f mod 100;
    if f=0 then f:=1;
    if cz=p then
       begin
         n:=i;
         break;
       end;
    end;
write(h,n);
close(g);
close(h);
end.