Cod sursa(job #362492)

Utilizator Gandalf29Demeter Csaba Gandalf29 Data 9 noiembrie 2009 21:08:41
Problema Factorial Scor 10
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.41 kb
var f:text;
    j,k,i,n,p:longint;

begin
 assign(f,'fact.in');
 reset(f);
 readln(f,p);
 close(f);
 if p=0 then begin
  i:=6;
 end
 else begin
 k:=0;
 i:=5;
 j:=0;
 while k<p do
 begin
  inc(k);
  inc(j);
  if j mod 5 =0 then inc(k);
  if j mod 25=0 then inc(k,2);
  if j mod 625=0 then inc(k,4);

  inc(i,5);

 end;
 end;
 assign(f,'fact.out');
 rewrite(f);
 writeln(f,i-5);
 close(f);
end.