atcoder#ABC283H. [ABC283Ex] Popcount Sum
[ABC283Ex] Popcount Sum
Score : points
Problem Statement
Find the sum of popcounts of all integers between and , inclusive, such that the remainder when divided by equals . Here, the popcount of a positive integer is the number of s in the binary notation of , that is, the number of non-negative integers such that the s place is . For each input, process test cases.
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format. The first line is as follows:
test cases follow. Each of them is given in the following format:
Output
Print lines. The -th line should contain the answer to the -th test case.
2
12 5 1
6 1 0
6
9
In the -st test case, the popcount of is , the popcount of is , and the popcount of is , so should be printed. In the -nd test case, the popcount of is , is , is , is , is , and is , so should be printed.