Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
166864 | qiuyanshen | 二进制分类 | C++ | 解答错误 | 0 | 0 MS | 244 KB | 406 | 2024-08-19 15:27:40 |
#include<bits/stdc++.h> using namespace std; void f(int n,int one,int zero){ while(n>0){ if(n%2==1) one++; else zero++; n=n/2; } } int main(){ int a,b; cin>>a>>b; int one=0,zero=0; int A=0,B=0; for(int i=a;i<=b;i++){ f(i,one,zero); if(one>zero)A++; else B++; } cout<<A<<" "<<B; }