Cod sursa(job #235539)

Utilizator ioalexno1Alexandru Bunget ioalexno1 Data 24 decembrie 2008 12:55:39
Problema Factorial Scor 15
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.63 kb
program alex;
var f,g:text;
    p,h,j,i,d,s:longint;
begin
assign(f,'fact.in');reset(f);
readln(f,p);
close(f);
assign(g,'fact.out');rewrite(g);
if p=0 then write(g,1)
       else begin
            i:=5;
            s:=1;
            while s<p do
                  begin
                  i:=i+5;
                  s:=0;
                  j:=i;
                  h:=1;
                  while(j div h)<>0 do
                        begin
                        h:=h*5;
                        s:=s+(j div h);
                        end;
                  end;
            write(g,i);
            end;
close(g);
end.