Cod sursa(job #24405)

Utilizator ScrazyRobert Szasz Scrazy Data 2 martie 2007 11:28:32
Problema Triplete Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.51 kb
var n,m:longint;
    i,j,x,y,db,k:longint;
    a:array[1..40,1..40] of 0..1;
    v:array[1..4096] of longint;
    f:text;
begin
  assign(f,'triplete.in');
  reset(f);
  readln(f,n,m);
  for i:=1 to m do begin
    readln(f,x,y);
    a[x,y]:=1;
    a[y,x]:=1;
  end;
  close(f);
  db:=0;
  for i:=1 to n do
    for j:=i+1 to n do
      v[j]:=v[j]+a[i,j];
  for i:=2 to n do
    if v[i]>1 then db:=db+v[i]-1;



  assign(f,'triplete.out');
  rewrite(f);
  writeln(f,db);
  close(f);

end.