Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var mas:array[1..100000] of longint;
- ans_full:qword;
- i,j,n,k:longint;
- function abc(a,b: longint): integer;
- var k1,k2,ans: longint;
- begin
- ans:=0;
- while (a>0) and (b>0) do
- begin
- k1:= a mod 2;
- k2:= b mod 2;
- if k1 <> k2 then inc(ans);
- a:= a div 2;
- b:= b div 2;
- end;
- exit(ans);
- end;
- begin
- assign(input,'input.txt');
- reset(input);
- assign(output,'output2.txt');
- rewrite(output);
- readln(n,k);
- for i:=1 to n do
- read(mas[i]);
- ans_full:=0;
- for i:=1 to n do
- for j:=i+1 to n do
- if abc(mas[i],mas[j]) = k then inc(ans_full);
- writeln(ans_full);
- close(input);
- close(output);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement