CF1770F.Koxia and Sequence
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Mari has three integers n , x , and y .
Call an array a of n non-negative integers good if it satisfies the following conditions:
- a1+a2+…+an=x , and
- a1∣a2∣…∣an=y , where ∣ denotes the bitwise OR operation.
The score of a good array is the value of a1⊕a2⊕…⊕an , where ⊕ denotes the bitwise XOR operation.
Koxia wants you to find the total bitwise XOR of the scores of all good arrays. If there are no good arrays, output 0 instead.
输入格式
The first line of input contains three integers n , x and y ( 1≤n<240 , 0≤x<260 , 0≤y<220 ).
输出格式
Output a single integer — the total bitwise XOR of the scores of all good arrays.
输入输出样例
输入#1
3 5 3
输出#1
2
输入#2
100 0 100
输出#2
0
输入#3
79877974817 749875791743978 982783
输出#3
64
说明/提示
In the first test case, there are 12 good arrays totally as follows.
- [0,2,3] , [0,3,2] , [2,0,3] , [2,3,0] , [3,0,2] and [3,2,0] — the score is 0⊕2⊕3=1 ;
- [1,2,2] , [2,1,2] and [2,2,1] — the score is 1⊕2⊕2=1 ;
- [1,1,3] , [1,3,1] and [3,1,1] — the score is 1⊕1⊕3=3 .
Therefore, the total bitwise xor of the scores is 9 times1⊕…⊕1⊕3⊕3⊕3=2 .
In the second test case, there are no good sequences. The output should be 0 .