Pagini recente » Cod sursa (job #1275405) | Cod sursa (job #1829339) | Cod sursa (job #1997181) | Cod sursa (job #3171247) | Cod sursa (job #25554)
Cod sursa(job #25554)
program puteri;
type triple=record
a,b,c:longint;
end;
var f,g:text;
v:array[1..100001] of triple;
n:longint;
procedure iofile;
var i:longint;
begin
assign(f,'puteri.in');
reset(f);
assign(g,'puteri.out');
rewrite(g);
readln(f,n);
for i:=1 to n do
readln(f,v[i].a,v[i].b,v[i].c);
close(f);
end;
function cmmdc(x,y:longint):longint;
begin
if y=0 then
cmmdc:=x else
cmmdc:=cmmdc(y,x mod y);
end;
procedure prel;
var i,j,a,b,c,cm:longint;
np:qword;
begin
np:=0;
for i:=1 to n-1 do
for j:=i+1 to n do
begin
a:=v[i].a+v[j].a;
b:=v[i].b+v[j].b;
c:=v[i].c+v[j].c;
if ((a=0)and(b=0))or((a=0)and(c=0))or((b=0)
and(c=0)) then
inc(np) else
begin
if a=0 then
cm:=cmmdc(b,c) else
if b=0 then
cm:=cmmdc(a,c) else
if c=0 then
cm:=cmmdc(a,b) else
begin
cm:=cmmdc(a,b);
cm:=cmmdc(cm,c); end;
if cm<>1 then inc(np);end;
end;
writeln(g,np);
close(g);
end;
begin
iofile;
prel;
end.