Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
99090 黄戈 二进制分类 C++ 通过 100 0 MS 240 KB 333 2023-08-21 23:12:45

Tests(4/4):


#include <iostream> using namespace std; int A, B, cnt0, cnt1; int main() { int n, m, t, temp; cin >> n>>m; for (int i = n; i <= m; i++) { cnt0 = 0, cnt1 = 0; t = i; while (t) { temp = t & 1; t = t >> 1; if (temp) cnt1++; else cnt0++; } cnt1 > cnt0 ? A++ : B++; } cout << A << ' ' << B; }


测评信息: