提交时间:2024-08-19 19:13:10

运行 ID: 167836

#include <iostream> using namespace std; bool isPowerOfTwo(int x) { return (x > 0) && (x & (x - 1)) == 0; } int main() { int n, a; cin >> n; for (int i = 1; i <= n; i++) { cin >> a; if (isPowerOfTwo(a)) { cout << "Yes" << "\n"; } else { cout << "No" << "\n"; } } return 0; }