Mai intai trebuie sa te autentifici.

Cod sursa(job #171243)

Utilizator AndreiDDiaconeasa Andrei AndreiD Data 3 aprilie 2008 21:47:03
Problema Factorial Scor 30
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.35 kb
var nr,z,p,i:longint;
f:text;
begin
assign(f,'fact.in');reset(f);
read(f,p);
assign(f,'fact.out');rewrite(f);
z:=0;
i:=0;
while z<p do begin
i:=i+5;
nr:=i;
while nr mod 5=0 do begin
inc(z);
nr:=nr div 5;
                     end;
end;
if z>p then writeln(f,-1)
       else if p=0 then writeln(f,1)
       else writeln(f,i);
  close(f);
end.