Pagini recente » Cod sursa (job #540253) | Cod sursa (job #1468273) | Cod sursa (job #1460773) | Cod sursa (job #425362) | Cod sursa (job #779253)
Cod sursa(job #779253)
var a:array[1..501]of integer; n,i,j,c,b,r:integer; s:qword;
begin
assign(input,'indep.in'); reset(input);
readln(n);
for i:=1 to n do readln(a[i]);
s:=0;
assign(output,'indep.out'); rewrite(output);
for i:=1 to n do
for j:=i+1 to n do
begin
if a[i]>a[j] then begin c:=a[i]; b:=a[j] end else begin c:=a[j]; b:=a[i] end;
r:=0;
repeat
r:= c mod b;
c:=b;
b:=r;
until r=0;
if c=1 then s:=s+((1 shl (n-j+1)) div 2);
end;
writeln(s);
close(output);
end.