Pagini recente » Cod sursa (job #1714026) | Cod sursa (job #1299044) | Cod sursa (job #1071854) | Cod sursa (job #1232653) | Cod sursa (job #36355)
Cod sursa(job #36355)
type inte=0..65536;
var f,g:text;
a:array[1..4096,1..4096] of 0..1;
m,i,c:inte;
n,j,k,x,y:integer;
begin
assign(f,'triplete.in');
reset(f);
readln(f,n,m);
fillchar(a,sizeof(a),0);
for i:=1 to m do
begin
readln(f,x,y);
a[x,y]:=1;
a[y,x]:=1;
end;
close(f);
c:=0;
for i:=1 to n do
begin
for j:=1 to n do
begin
if (a[i,j]=1)and(a[j,i]=1) then
begin
a[j,i]:=0;
for k:=1 to n do
if (a[j,k]=1)and(a[i,k]=1) then
begin a[k,i]:=0; inc(c); end;
end; end; end;
assign(g,'triplete.out');
rewrite(g);
writeln(g,c);
close(g);
end.