提交时间:2023-08-22 08:16:44

运行 ID: 99108

#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; }