Cod sursa(job #478339)

Utilizator andreii1Ilie Andrei andreii1 Data 18 august 2010 10:13:12
Problema Factorial Scor 35
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.38 kb
var k,i,p,x:longint;
    f,g:text;
begin
assign(f,'fact.in');
assign(g,'fact.out');
reset(f);
rewrite(g);
read(f,k);
i:=0;
p:=0;
while p<k do
      begin
      i:=i+5;
      x:=i;
      while x mod 5=0 do
            begin
            p:=p+1;
            x:=x div 5;
            end;
      end;
if k=0 then i:=1;
if p>k then i:=-1;
write(g,i);
close(f);
close(g);
end.