Pagini recente » Cod sursa (job #673522) | Cod sursa (job #144547) | Cod sursa (job #1830651) | Cod sursa (job #2086542) | Cod sursa (job #110355)
Cod sursa(job #110355)
var a,b,cor:array[1..50] of real;
ok:array[1..50]of boolean;
s:real;
f,g:text;
i,j,n:longint;
function nrkkt(x:real):boolean;
begin
while frac(x/5) =0 do x:=x/5;
while frac(x/3) =0 do x:=x/3;
while frac(x/2) =0 do x:=x/2;
if x<>1 then nrkkt:=false else nrkkt:=true;
end;
{--------------------}
begin
assign(f,'aliens.in'); reset(f);
assign(g,'aliens.out'); rewrite(g);
readln(f,n);
fillchar(ok,sizeof(ok),false);
for i := 1 to n do begin
readln(f,a[i],b[i]);
cor[i]:=a[i]/b[i];
if (nrkkt(a[i]) and nrkkt(b[i])) then ok[i]:=true else ok[i]:=false;
if a[i]=1 then begin if nrkkt(b[i]) = true then ok[i]:=true; end else
if b[i]=1 then begin if nrkkt(a[i]) = true then ok[i]:=true; end;
end;
s:=1;
for i := 1 to n do
if (cor[i]>1) and ok[i] then s:=s*cor[i];
writeln(g,s:0:0);
close(f);
close(g);
end.