Pagini recente » Cod sursa (job #1129065) | Cod sursa (job #174020) | Cod sursa (job #1081413) | Cod sursa (job #499692) | Cod sursa (job #47531)
Cod sursa(job #47531)
type matrice=array[1..4096,1..4096] of 0..1;
var a:matrice;
i,n,z,j,q,w:1..4096;
f,g:text;
m,nr:longint;
begin
assign(f,'triplete.in'); assign(g,'triplete.out');
reset(f); rewrite(g);
readln(f,n,m);
for i:=1 to n do
for j:=1 to n do
a[i,j]:=0;
for i:=1 to m do
begin
readln(f,q,w);
a[q,w]:=1;
a[w,q]:=1;
end;
nr:=0;
for i:=1 to n do
begin
for j:=1 to n do
if a[i,j]=1 then
for z:=1 to n do
if a[j,z]=1 then
if a[z,i]=1 then
begin
inc(nr);
a[z,i]:=0;
a[i,z]:=0;
end;{ else begin a[z,i]:=0; a[i,z]:=0; end; }
{ for z:=1 to n do
a[z,i]:=0;
a[i,z]:=0;}
end;
write(g,nr);
close(f); close(g);
end.