Pagini recente » Cod sursa (job #2466832) | Cod sursa (job #432500) | Cod sursa (job #1711320) | Cod sursa (job #598720) | Cod sursa (job #109411)
Cod sursa(job #109411)
var n:longint;
a:array[1..100000] of longint;
nr:int64;
procedure citire;
var i:longint;
begin
assign(input,'pairs.in');
reset(input);
readln(n);
for i:=1 to n do
readln(a[i]);
close(input);
end;
function ok(a,b:longint):boolean;
var r:longint;
begin
r:=0;
while b>0 do
begin
r:=a mod b;
a:=b;
b:=r;
end;
if a=1 then
ok:=true
else
ok:=false;
end;
procedure prel;
var i,j:longint;
begin
for i:=1 to n-1 do
for j:=i+1 to n do
if ok(a[i],a[j]) then
nr:=nr+1;
writeln(nr);
end;
begin
assign(output,'pairs.out');
rewrite(output);
citire;
prel;
close(output);
end.