Pagini recente » Cod sursa (job #2540811) | Cod sursa (job #2950025) | Cod sursa (job #93173) | Cod sursa (job #526922) | Cod sursa (job #46622)
Cod sursa(job #46622)
const b=32;
var x:array[1..4096,1..(4096 div b) +1]of longword;
f,g:text;
k,m,a1,a2,tri,l,n,c,t,pas:longword;
begin
assign(f,'triplete.in');
reset(f);
read(f,n,m);
pas:=n div b;
if(n mod b <>0)then
pas:=pas+1;
tri:=0;
for k:=1 to m do
begin
read(f,a1,a2);
for t:=1 to pas do
begin
l:=x[a1,t] and x[a2,t];
while(l>0)do
begin
l:=l and(l-1);
tri:=tri+1;
end;
end;
c:=(a2 div b)+1;
x[a1,c]:=x[a1,c] or (1 shl (a2 mod b));
c:=(a1 div b)+1;
x[a2,c]:=x[a2,c] or (1 shl(a1 mod b));
end;
close(f);
assign(g,'triplete.out');
rewrite(g);
writeln(g,tri);
close(g);
end.