Cod sursa(job #584616)

Utilizator lehman97Dimulescu David lehman97 Data 26 aprilie 2011 09:31:19
Problema Factorial Scor 10
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.39 kb
var   s,x,g,p,t,i,j:longint;
      st:string;
      ok:boolean;
begin
assign(input,'fact.in');reset(input);
assign(output,'fact.out');rewrite(output);
read(p);
ok:=true;
s:=1;
while ok do begin
inc(x);
for i:=1 to x do
s:=s*i;
str(s,st);
for j:=1 to length(st)do begin
if st[j]='0' then t:=1;
if t=1 then inc(g);
end;
t:=0;
if g=p then ok:=false;
s:=1;
g:=0;
end;
write(x);
end.