Cod sursa(job #173387)

Utilizator spiderboy193Mahu Razvan spiderboy193 Data 7 aprilie 2008 18:46:36
Problema Factorial Scor 20
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.36 kb
var p,k,k2,k5,c:longint;
    f,g:text;
begin
assign(f,'fact.in');reset(f);
assign(g,'fact.out');rewrite(g);
read(f,p);
if p=0 then begin writeln(g,1);close(f);close(g); exit; end;
while p<>0 do begin
inc(c);k:=c;
while(k mod 5=0)and(k>0)do begin inc(k5);k:=k div 5; end;
while k5>0 do begin dec(k5);dec(p); end;
end;
writeln(g,c);
close(f);close(g);
end.