题解 | Poi 的新加法(Easy Version)

Poi 的新加法(Easy Version)

https://www.nowcoder.com/practice/9f766daa7e4042a786633c341fe9d7e2

#include <iostream>
using namespace std;
#include<vector>
#include<algorithm>
 long long re(long long a,long long b){

return a+b-(a^b);


 }
int main(){
int t;
cin>>t;
while(t--){
    vector<long long>a;
long long n,q;
cin>>n>>q;
long long c=0;
for(int i=1;i<=n;i++){
long long b;
cin>>b;
a.push_back(b);


}
long long l,r;
cin>>l>>r;
if(n==1){
    cout<<a[0]<<endl;
}
else{
c=a[0];
for(int i=1;i<n;i++){

    c=re(c,a[i]);
}
cout<<c<<endl;

}
}




    return 0;
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务