0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 17:36:27 +00:00
OI-codes/Codeforces/1688/A/A.cpp

33 lines
553 B
C++

#include <iostream>
using std::cin;
using std::cout;
const char endl = '\n';
int t, x, y;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> t;
while (t--) {
cin >> x;
int k = 0;
while (!((x >> k) & 1) && k <= 30) k++;
y = 1 << k; // 此时满足 (x & y) > 0
if ((x ^ y) <= 0) {
int k = 0;
while (((x >> k) & 1) && k <= 30) k++;
y += 1 << k; // 此时满足 (x ^ y) > 0
}
cout << y << endl;
}
return 0;
}