Cod sursa(job #287589)

Utilizator muskMuscalu Alexandru musk Data 24 martie 2009 23:10:38
Problema Triplete Scor 70
Compilator fpc Status done
Runda aa Marime 0.6 kb
 var a:array[1..4096,1..4096]of boolean;
    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]:=false;
for k:=1 to m do
    begin
    readln(f,i,j);
    a[i,j]:=true;
    a[j,i]:=true;
    end;
for i:=1 to n do
 for j:=i+1 to n do
        begin
        if a[i,j]=true then
               for k:=j+1 to n do
                     if a[i,k]=true then
                        if a[j,k]=true then inc(nr);
        end;
writeln(g,nr);
close(f);
close(g);
end.