个人简介
#include <bits/stdc++.h>
using namespace std;
long long n,h,f[10];
int main()
{
cin >> n;
h = 2 * n + 2;
for(int i = 1;i <= h;i++)
{
int x;
cin >> x;
f[x % 10] = f[x % 10] ^ x;
}
sort(f + 0,f + 9 + 1);
cout << f[8] << " " << f[9];
return 0;
}
#include <bits/stdc++.h> using namespace std; int n, ai; int sum[35]; int all; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n; n = n * 2 + 2; for (int i = 1; i <= n; i++) { cin >> ai; all = all ^ ai; for (int pos = 0; pos <= 29; pos++) { // (ai >> pos) & 1 if (ai & (1 << pos)) sum[pos] = sum[pos] ^ ai; } } for (int i = 0; i <= 29; i++) { if (sum[i] == 0 || sum[i] == all) continue; // 有一个数为 sum[i] // 两个数的异或和为 all // 两个数分别为 sum[i], all^sum[i]
(内容超过 1KB,自动截断)
奖章
TA 还没有布置奖章展示柜。