#abc283h. Ex - Popcount Sum
Ex - Popcount Sum
Score : points
问题描述
计算在到(包括两端)之间所有整数的按位计数总和,条件是这些整数除以的余数等于。
这里,一个正整数的按位计数(popcount)是指其二进制表示中的数量,即满足位为的非负整数的数量。
对于每次输入,请处理组测试用例。
以上为通义千问 qwen-max 翻译,仅供参考。
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.
Sample Input 1
2
12 5 1
6 1 0
Sample Output 1
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.
update @ 2024/3/10 11:53:19