題意:

解法:
令t=(x^y),t有兩種情況:
1.如果t<=x,那么一次操作就行:直接將x^=t即可.
2.如果t>x,那么進行兩次操作:先將x^=y,這時候x=t,然后將x^=舊的x,這時候x=y.
code:
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios::sync_with_stdio(0);cin.tie(0);
int x,y;cin>>x>>y;
int t=(x^y);
if(t<=x){
cout<<1<<endl;
cout<<t<<endl;
}else{
cout<<2<<endl;
cout<<y<<' '<<t<<endl;
}
return 0;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/243866.html
標籤:其他
