10

Count pairs which differ in K bits

 2 years ago
source link: http://codeforces.com/blog/entry/114406
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Count pairs which differ in K bits

Hi, I spent one day for this problem but I haven't come up with solution for this problem. Can you take a look at this problem? Thanks.

Statements:

Given an array which have elements which values are , count all pairs in array which differ in exactly bits of binary representation of both the numbers.

Sample Input:

5 2
2 4 1 3 1

Sample Output:

5

Explanation:

Link: https://www.spoj.com/PTIT/problems/P186PROF/ (in Vietnamese since I can't find any other links). Test case for this problem in SPOJ is weak, since I got accepted with time complexity . But this is not the intended soluton, maybe.


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK