Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
99108 陈志轩 二进制分类 C++ 通过 100 0 MS 256 KB 863 2023-08-22 08:16:44

Tests(4/4):


#include<bits/stdc++.h> //#define int long long using namespace std; namespace Fast{ inline int fr(){ register int x = 0,f = 1; static char c = getchar(); while (c < '0' || c > '9'){ if (c == '-'){ f = -1; } c = getchar(); } while (c >= '0' && c <= '9'){ x = (x << 1) + (x << 3) + (c ^ 48); c = getchar(); } return x * f; } inline void fw(int x){ if (x < 0){ x = -x; putchar('-'); } if (x > 9){ fw(x / 10); } putchar(x % 10 + 48); } } using namespace Fast; int ans1,ans2; inline void f(int x){ int sum[2] = {0,0}; while (x){ sum[x % 2]++; x /= 2; } if (sum[0] < sum[1]){ ans1++; } else{ ans2++; } } signed main(){ int a,b; a = fr(),b = fr(); for (int i = a;i <= b;i++){ f(i); } fw(ans1); putchar(' '); fw(ans2); return 0; }


测评信息: