Pagini recente » Cod sursa (job #2760999) | Clasament FMI No Stress 4 | Cod sursa (job #2704184) | Cod sursa (job #2725594) | Cod sursa (job #78416)
Cod sursa(job #78416)
program factorial1;
var p:byte;
f:text;
function det(p:byte):integer;
var i,n,c:byte;
s:word;
begin
if p>1 then
begin
n:=1;
repeat
c:=0;
s:=1;
for i:= 1 to n do
begin
s:=s*i;
if s mod 10=0 then
begin
inc(c);
s:= s div 10;
end;
if s>2000 then
s:=s mod 1000;
end;
inc(n);
until p=c;
if p=c then
det:=n-1;
end;
if p=1 then
det:=5;
if p=0 then
det:=1;
end;
begin
assign(f,'fact.in');
reset(f);
read(f,p);
close(f);
assign(f,'fact.out');
rewrite(f);
write(f,det(p));
close(f);
end.