Cod sursa(job #337037)

Utilizator horascosma horatiu horas Data 2 august 2009 13:09:12
Problema Factorial Scor 30
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.6 kb
program sasas;
var p,n,k,x:longint;
    f:text;
begin
assign(f,'fact.in');reset(f);
read(f,p);
close(f);
repeat
      inc(n);
      if n mod 5=0 then begin
                        x:=n;
                        inc(k);
                        while x mod 5=0 do begin
                                           inc(k);
                                           x:=x div 5;
                                           end;
                        end
                   else inc(k);
until k>=p;
assign(f,'fact.out');rewrite(f);
if p=0 then write(f,'1')
       else write(f,n*5);
close(f);
end.