Cod sursa(job #61456)
| Utilizator | Data | 19 mai 2007 16:18:28 | |
|---|---|---|---|
| Problema | Factorial | Scor | 15 |
| Compilator | fpc | Status | done |
| Runda | Arhiva de probleme | Marime | 0.58 kb |
var sol:array[1..40000000]of int64;
s,i,ct,rez:longint;
fi,fo:text;
procedure afla(s:longint);
begin
for i:=1 to 3000000 do
begin
ct:=5;
while ct<=i do
begin
sol[i]:=sol[i]+trunc(i/ct);
ct:=ct*5;
end;
if sol[i]=s then begin rez:=i; exit; end;
end;
end;
begin
assign(fi,'fact.in'); reset(fi);
assign(fo,'fact.out'); rewrite(fo);
read(fi,s);
afla(s);
writeln(fo,rez);
close(fi);
close(fo);
end.
