###name
Pair
###descirption
Given three integers A, B, C. Count the number of pairs <x,y> (with
1≤x≤A and 1≤y≤B)such that at least one of the following is true:
- (x and y) > C
- (x xor y) < C
(“and”, “xor” are bit operators)
###input
The first line of the input gives the number of test cases, T (T≤100). T test cases follow.
For each test case, the only line contains three integers A, B and C.
$1≤A,B,C≤10^9$
###output
For each test case, the only line contains an integer that is the number of pairs satisfying the condition given in the problem statement.
###sample input
3
3 4 2
4 5 2
7 8 5
###sample output
5
7
31
###toturial
可以直接dfs搜索,然后记忆化加速,写起来很复杂,但是能过
###code
1 |
|
###toturial2
考虑数位dp
###code
1 |
|
- 本文作者: fightinggg
- 本文链接: http://fightinggg.github.io/yilia/yilia/PVX51D.html
- 版权声明: 本博客所有文章除特别声明外,均采用 MIT 许可协议。转载请注明出处!