Cod sursa(job #45651)

Utilizator el_marius77Marius Necula el_marius77 Data 1 aprilie 2007 19:31:40
Problema Triplete Scor 40
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.53 kb
const MAX=4096;

var f,g:text;
    a:array[1..MAX,1..MAX] of byte;
{    v:array[0..MAX*MAX] of byte;}
    t,n1,n2,n3,nt,x,y,n,m,i,j,k,num:word;


begin
  assign(f,'triplete.in');
  reset(f);
  read(f,n,m);
  num:=0;
  for t:=1 to m do begin
    read(f,i,j);
    if a[i,j]=1 then continue;
    a[i,j]:=1;
    a[j,i]:=1;
    for k:=1 to n do begin
      if (a[i,k]=0) or (a[k,j]=0) then continue;
      num:=num+1;
    end;
  end;
  close(f);
  assign(g,'triplete.out');
  rewrite(g);
  writeln(g,num);
  close(g);

end.