Pagini recente » Cod sursa (job #2293497) | Cod sursa (job #1758082) | Cod sursa (job #1434110) | Cod sursa (job #1190221) | Cod sursa (job #28197)
Cod sursa(job #28197)
program puteri;
type sir=array[1..100000] of byte;
var a,b,c:sir;
f,g:text;
n:longint;
procedure citire;
var i:longint;
begin
assign (f,'puteri.in'); reset (f);
read (f,n);
for i:=1 to n do readln (f,a[i],b[i],c[i]);
close (f);
end;
function cmmdc(x,y:longint):longint;
var r:longint;
begin
while y<>0 do begin
r:=x mod y;
x:=y;
y:=r
end;
cmmdc:=x
end;
procedure verificare;
var i,j,sa,sb,sc,t,aux:longint;
begin
t:=0;
assign (g,'puteri.out'); rewrite (g);
for i:=1 to n do begin
for j:=i+1 to n do
begin sa:=a[i]+a[j];
sb:=b[i]+b[j];
sc:=c[i]+c[j];
if (sa=sb) and (sb=sc) then inc (t)
else
if (sa mod 2=0) and (sb mod 2=0) and (sc mod 2=0) then inc (t)
else begin
if sa<sb then begin aux:=sa;
sa:=sb;
sb:=aux
end;
if sa<sc then begin aux:=sc;
sc:=sa;
sa:=aux;
end;
if sb<sc then begin aux:=sb;
sb:=sc;
sc:=aux
end;
if sc>0 then
if (sc>1)and(sa mod sc=0) and (sb mod sc=0) then inc (t)
else
else
if sb=0 then if sa>1 then inc (t) else
else if cmmdc(sa,sb)<>1 then inc (t);
end;
end;
end;
write (g,t);
close (g);
end;
begin
citire;
verificare;
end.