Cod sursa(job #49917)

Utilizator florin_marius90Florin Marius Popescu florin_marius90 Data 6 aprilie 2007 16:17:48
Problema Puteri Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 1 kb
type punct=record
           a,b,c:0..64;
           end;
     vector=array[1..10000] of punct;

var v:vector;
    nr:longint;
    f,g:text;
    n,j,i:1..100000;
begin
assign(f,'puteri.in'); assign(g,'puteri.out');
reset(f); rewrite(g);
readln(f,n);

for i:=1 to n do
readln(f,v[i].a,v[i].b,v[i].c);
nr:=0;
for i:=1 to n-1 do
 for j:=i+1 to n do
  begin
  if (v[i].a+v[j].a=0) and (v[i].b+v[j].b=v[i].c+v[j].c) and(v[i].b+v[j].b>1) then inc(nr);
  if (v[i].b+v[j].b=0) and (v[i].a+v[j].a=v[i].c+v[j].c) and(v[i].a+v[j].a>1) then inc(nr);
  if (v[i].c+v[j].c=0) and (v[i].a+v[j].a=v[i].b+v[j].b) and(v[i].a+v[j].a>1) then inc(nr);

  if (v[i].a+v[j].a=0) and (v[i].b+v[j].b=0) and(v[i].c+v[j].c>1) then inc(nr);
  if (v[i].a+v[j].a=0) and (v[i].c+v[j].c=0) and(v[i].b+v[j].b>1) then inc(nr);
  if (v[i].b+v[j].b=0) and (v[i].c+v[j].c=0) and(v[i].a+v[j].a>1) then inc(nr);
  if (v[i].c+v[j].c>1) and (v[i].b+v[j].b>1) and (v[i].a+v[j].a>1) then inc(nr);
  end;

write(g,nr);
close(f); close(g);
end.