You can go to CF to find the question.
Analysis process:
If it is an even number, it is directly equal to dividing by 2, for example, F (8) = f (4) = F (2) = F (1)
If it is an odd number, add 1 after dividing by 2 directly, for example, F (1) = f (0) + 1 = 0 + 1 = 1
It can be proved that the Left and Right numbers can be continuously divided by 2, and the formula is obtained: F (0) + x = x.
So what is X?
First, we can see through observation that as long as it is a number larger than 1, after dividing by 2, we can get 1 at last, whether it is an odd or even number.
Second, we can see through the formula that if it is an even number, it is like 8. After dividing it by 2, it will not increase the value of X. Only after dividing the odd number by 2, the remainder 1 will be added to X outside function f. Therefore, the key to the problem is: divide the original one until the division is zero, the total number of vendors (including the original number) is an odd number.
Then, if a number passes through to obtain the simplest constant, if it is the same, it means F (a) = F (B). Finally, as long as we look at the computed series, number of occurrences of each number. The number of identical pairs is calculated by means of permutation and combination.
Code As follows:
// B // By Molly # include
# include
using namespace STD; const int n = 100010; typedef long ll; ll N, seq [N], num [40], K; int main () {While (CIN> N) {for (INT I = 0; I
seq [I]; while (SEQ [I]) {If (SEQ [I] % 2 = 1) K ++; seq [I]/= 2;} num [k] ++;} ll ans = 0; for (INT I = 1; I <34; ++ I) {ans + = num [I] * (Num [I]-1)/2 ;} cout