Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
99070 王为治 二进制分类 C++ 通过 100 0 MS 272 KB 558 2023-08-21 20:41:15

Tests(4/4):


#include <bits/stdc++.h> //#pragma GCC optimize(2) //#define int long long #define endl '\n' #define ll long long #define ull unsigned long long using namespace std; bool check(int n) { int one=0,zero=0; while(n) { if(n&1)one++; else zero++; n>>=1; } return one>zero; } signed main() { std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int a,b; cin >> a >> b; int A=0,B=0; for(int i = a; i <= b; i++) { if(check(i))A++; else B++; } cout << A << " " << B << endl; return 0; }


测评信息: