Cod sursa(job #577871)

Utilizator razvan.nicolescuNicolescu Razvan razvan.nicolescu Data 10 aprilie 2011 18:22:52
Problema Factorial Scor 35
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.52 kb
var
p,i,aux,exp:longint;
f,g:text;
begin
        assign(f,'fact.in');reset(F);
        ASSIGN(G,'fact.out');rewrite(g);
        readln(f,p);
        if p=0 then writeln(g,1);
        exp:=0;
        i:=0;
        while exp<p do begin
              i:=I+5;
              aux:=i;
              while aux mod 5=0 do begin
                aux:=aux div 5;
                inc(exp);
              end;
        end;
        if exp>p then writeln(g,-1)
        else writeln(g,i);
        close(F);
        close(g);
end.