#include<iostream> using namespace std; int n; int main() { cin>>n; int res=0; for(int i=1; i<=n; i++) { int x; cin>>x; if(i%2) res=res^x;//判断是不是奇数 } if(res!=0) cout<<"Yes"<<endl; else cout<<"No"<<endl; return 0; }
2022-08-26 12:06:40
#include<iostream> using namespace std; int n; int main() { cin>>n; int res=0; for(int i=1; i<=n; i++) { int x; cin>>x; if(i%2) res=res^x;//判断是不是奇数 } if(res!=0) cout<<"Yes"<<endl; else cout<<"No"<<endl; return 0; }