Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
167904 | B班 李文乐 | 二进制半整数 | C++ | 解答错误 | 40 | 4 MS | 248 KB | 383 | 2024-08-19 20:29:01 |
#include <bits/stdc++.h> using namespace std; bool f(int n) { int cnt = 0; while (n) { cnt += n & 1; if (cnt > 2) return false; n >>= 1; } return cnt == 2; } int main() { int t; cin >> t; while (t--) { int n; cin >> n; cout << (f(n) ? "yes" : "no") << endl; } return 0; }