Pagini recente » Cod sursa (job #2846808) | Cod sursa (job #735349) | Cod sursa (job #2682178) | Cod sursa (job #1360038) | Cod sursa (job #88926)
Cod sursa(job #88926)
program triplete;
var x,y: array[1..65536] of integer;
A:array[1..4096,1..4096] of byte;
m,n,i,j,rez: longint;
function suma(x,y:integer):longint;
var j: integer;
r: longint;
begin
r:=0;
for j:=1 to n do
if A[x,j]*A[y,j]=1 then r:=r+1;
suma:=r;
end;
begin
assign(input,'triplete.in');
reset(input);
readln(n,m);
for i:=1 to m do
begin
readln(x[i],y[i]);
A[x[i],y[i]]:=1;
end;
for i:=1 to m do
rez:=rez+suma(x[i],y[i]);
assign(output,'triplete.out');
rewrite(output);
write(rez);
close(input);
close(output);
end.