[语言月赛 202312] 异或构造题?
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
题目描述
给定 个非负整数 ,你需要确定一个非负整数 ,使得 $a _ 1 \oplus a _ 2 \oplus \cdots \oplus a _ n \oplus x$ 最小。
你需要计算 和 $a _ 1 \oplus a _ 2 \oplus \cdots \oplus a _ n \oplus x$。
其中 代表异或, 在 C++ 中可表示为 x ^ y。
对于两个非负整数 ,它们的异或是指,将它们作为二进制数,对二进制表示中的每一位进行如下运算得到的结果:
- 和 的这一位上不同时,结果的这一位为 ;
- 和 的这一位上相同时,结果的这一位为 。
例如:,,,。
输入格式
输入共两行。
第一行一个整数 ,代表序列 的长度。
第二行 个整数 ,代表序列 。
输出格式
输出共一行两个整数 和 $a _ 1 \oplus a _ 2 \oplus \cdots \oplus a _ n \oplus x$。
2
1 2
3 0
2
7 7
0 0
提示
数据规模与约定
对于 的数据,,。
| 测试点 | 特殊性质 | ||
|---|---|---|---|
| 无 | |||
| 无 | |||
20250927提高选修课作业——位运算和简单计数问题
- Status
- Done
- Problem
- 12
- Open Since
- 2025-9-27 10:45
- Deadline
- 2025-10-26 23:59
- Extension
- 24 hour(s)