牛客小白月赛-C-冰冰的异或 · znzryb
## 题目大意
给定多个 $n$,要求输出满足某种异或性质的最小的 $2^k$(或按题意构造出的答案)。本题可通过打表/找规律解决,并需要对小值(如 $n=1,2$)特判。
## AC代码
打表题
注意特判一下1 and 2
其他的没什么好多说的
**其实下次这种题目建议写一个对拍程序**
[](https://ac.nowcoder.com/acm/contest/view-submission?submissionId=72603358) AC
```cpp
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long ll;
ll T,n,a=1e18;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin>>T;
while (T--) {
cin>>n;
if(n==1 || n==2) {
cout<<1<<endl;
continue;
}
ll ans=1;
while(true) {
ans*=2;
if(ans>=n) {
cout<<ans<<endl;
break;
}
}
}
return 0;
}
```
## 心路历程(WA,TLE,MLE……)
哈哈,没特判2