Cod sursa(job #287213)

Utilizator muskMuscalu Alexandru musk Data 24 martie 2009 17:04:33
Problema Triplete Scor 70
Compilator fpc Status done
Runda aa Marime 0.58 kb
var a:array[1..4096,1..4096]of 0..1;
    i,j,n,nr:integer;     m,k:longint;
    f,g:text;

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