CF1770F.Koxia and Sequence
NOI/NOI+/CTSC
通过率:0%
时间限制:1.00s
内存限制:256MB
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.
玛莉有三个整数 n、x 和 y。
称一个由 n 个非负整数组成的数组 a 是“好的”,当且仅当它满足以下两个条件:
- a1+a2+…+an=x,且
- a1∣a2∣…∣an=y,其中 ∣ 表示按位或运算。
一个“好的”数组的得分定义为 a1⊕a2⊕…⊕an 的值,其中 ⊕ 表示按位异或运算。
Koxia 希望你求出所有“好的”数组的得分的按位异或总和。若不存在任何“好的”数组,则输出 0。
输入格式
The first line of input contains three integers n, x and y (1≤n<240, 0≤x<260, 0≤y<220).
输入的第一行包含三个整数 n、x 和 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.
输出一个整数——所有好数组的得分的按位异或(XOR)总和。
输入输出样例
输入#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.
在第一个测试用例中,总共有 12 个好数组,如下所示:
- [0,2,3]、[0,3,2]、[2,0,3]、[2,3,0]、[3,0,2] 和 [3,2,0] —— 得分为 0⊕2⊕3=1;
- [1,2,2]、[2,1,2] 和 [2,2,1] —— 得分为 1⊕2⊕2=1;
- [1,1,3]、[1,3,1] 和 [3,1,1] —— 得分为 1⊕1⊕3=3。
因此,所有得分的按位异或总和为 9 次1⊕…⊕1⊕3⊕3⊕3=2。
在第二个测试用例中,不存在好序列。输出应为 0。
输入解题思路,AI测评打分。不知道怎么写?