cf good bye 2019 C

And to make s in m sum , and to XOR X X .
There s in m + s in m + ( s in m + X ) = 2 ( s u m + X ) sum+sum+(sum+X)=2*(sum+X) X X ( X + s u m ) = X + s u m X\oplus X\oplus (X+sum)=X+sum
two numbers is added X X and s u m sum

#include<bits/stdc++.h>
using namespace std;
int main(){
    //freopen("in.txt","r",stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int t;
    cin>>t;
    while(t--){
        int n;
        long long bb;
        cin>>n;
        long long sum=0 ,x=0;
        for(int i=1;i<=n;i++){
            cin>>bb;
            sum+=bb;
            x^=bb;
        }
        cout<<2<<'\n';
        cout<<x<<' '<<sum+x<<'\n';
    }
}
Published 16 original articles · won praise 9 · views 760

Guess you like

Origin blog.csdn.net/weixin_42859385/article/details/104033610
Recommended