Cod sursa(job #6969)

Utilizator AV_Aceerou necunoscut AV_Ace Data 21 ianuarie 2007 11:16:00
Problema Triplete Scor 60
Compilator fpc Status done
Runda preONI 2007, Runda 1, Clasa a 10-a Marime 0.63 kb
program animale;
var f,g:text;
    a:array[1..4096,1..4096] of 0..1;
    n,m,i,j,k,x:word;
begin
assign(f,'triplete.in');
assign(g,'triplete.out');
reset(f); rewrite(g);
read(f,n,m);
for i:=1 to m do
        begin
        read(f,x,j);
        a[x,j]:=1;
        a[j,x]:=1;
        end;
x:=0;
for i:=1 to n-2 do
        for j:=i+1 to n-1 do
                if a[i,j]=1 then
                                for k:=j+1 to n do
                                        if (a[j,k]=1) and (a[k,i]=1) then
                                                                        x:=x+1;
writeln(g,x);
close(f); close(g);
end.