跳到正文

题解

题解:P13683 【MX-X16-T1】「DLESS-3」XOR and Greater Sum

CTLM_qwq_约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2026年3月1日
篇幅
约 1 分钟
题目
P13683

版本

  1. v1当前

题目传送门

题意

不要看题面说要选择这选择那的,其实就是求 nn 个数的异或和。

因为选全部的数就是最优。

思路

把所有数的异或和求出来并输出即可。

AC CODE

C++
#include <bits/stdc++.h>
using namespace std;
int main() {
	int t;
	cin >> t;
	while (t--) {
		int n;
		cin >> n;
		int ans = 0;
		for (int i = 1; i <= n; i++) {
			int a;
			cin >> a;
			ans ^= a;
		}
		if (ans > 0) {
			cout << "Yes\n";
		} else {
			cout << "No\n";
		}
	}
	return 0;
}
原文