Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- int differentBitsSumPairwise(vector<int> &arr, int n){
- //bitset < 32 > bt;
- long long ans=0;
- int bits=32;
- for(int i=0;i<bits ; i++){
- int zero=0 , one=0;
- for(int j=0;j<arr.size();j++){
- if(arr[j]&1) one++;
- else zero++;
- arr[j]/=2;
- }
- ans +=2*one*zero ;
- }
- return ans;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement