Pagini recente » preONI 2008 - Runda 3 | Cod sursa (job #1229049) | Cod sursa (job #1191531) | Cod sursa (job #6746) | Cod sursa (job #1271)
Cod sursa(job #1271)
program factorial;
var o2,o5,i,p,aux,nr:longint;
ok:boolean;
fin,fout:text;
{*----------------------------------*}
begin
assign(fin,'fact.in');
assign(fout,'fact.out');
reset(fin);
rewrite(fout);
readln(fin,p);
ok:=false;
nr:=0;
while not ok do
begin
o2:=0;
o5:=0;
nr:=nr+1;
for i:=1 to nr do
begin
aux:=i;
while aux mod 2 = 0 do
begin
o2:=o2+1;
aux:= aux div 2;
end;
while aux mod 5 = 0 do
begin
o5:=o5+1;
aux:=aux div 5;
end;
end;
if ((o5 > o2) and (o2= p)) then
begin
ok:=true;
writeln(fout,nr);
end;
if ((o2 > o5) and (o5= p)) then
begin
ok:=true;
writeln(fout,nr);
end;
end;
close(fout);
end.