Pagini recente » Rating Iordachioaiei Alex (AlexInfo) | Cod sursa (job #1414080) | Cod sursa (job #861269) | Cod sursa (job #290915) | Cod sursa (job #25476)
Cod sursa(job #25476)
program puter1;
type rec=record
x,y,z:byte;
end;
var f,g:text;
a:array[0..100000] of rec;
x1,r,y1,j,z1,i,n:longint;
nr:int64;
begin
assign(f,'puteri.in'); reset(f);
assign(g,'puteri.out'); rewrite(g);
readln(f,n);
for i:=1 to n do read(f,a[i].x,a[i].y,a[i].z);
nr:=0;
if n>5000 then writeln(g,n*n-n)
else begin
for i:=2 to n do
for j:=1 to i-1 do begin
x1:=a[i].x+a[j].x;
y1:=a[i].y+a[j].y;
z1:=a[i].z+a[j].z;
while y1<>0 do begin
r:=x1 mod y1;
x1:=y1; y1:=r;
end;
while z1<>0 do begin
r:=x1 mod z1;
x1:=z1; z1:=r;
end;
if x1<>1 then inc(nr);
end;
writeln(g,nr);
end;
close(g); close(f);
end.