不进位加法
要写成 < ,不是 <=
#include <bits/stdc++.h> using namespace std; #define int long long const int maxn = 1e5 + 5; int t,n,k; int a[maxn],ans; signed main(){ //freopen("in","r",stdin); ios::sync_with_stdio(0); cin >> t; while(t--){ cin >> n >> k; ans = 0; for(int i = 1; i <= n; i++){ cin >> a[i]; ans ^= a[i]; } if((ans ^ a[k]) < a[k]) cout << "Yes" << endl; else cout << "No" << endl; } return 0; }
来源:https://www.cnblogs.com/xcfxcf/p/12610133.html