Pagini recente » Cod sursa (job #2692657) | Cod sursa (job #2584144) | Cod sursa (job #3292699) | Cod sursa (job #3282474) | Cod sursa (job #116888)
Cod sursa(job #116888)
var f,g:text; n,c:longint; i,j:byte;
v:array[1..100000]of integer;
function cmmdc(x,y:integer):integer;
begin
while x<>y do
if x>y then x:=x-y
else y:=y-x;
cmmdc:=x;
end;
begin
assign(f,'pairs.in');reset(f);
assign(g,'pairs.out');rewrite(g);
readln(f,n); c:=0;
for i:=1 to n do readln(f,v[i]);
for i:=1 to n-1 do
for j:=1+i to n do
if (v[i]<>v[j]) and (cmmdc(v[i],v[j])=1) then c:=c+1;
write(g,c);
close(f);close(g);
end.