Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
167051 黄一航 二进制分类 C++ 通过 100 2 MS 240 KB 351 2024-08-19 15:56:26

Tests(4/4):


#include<bits/stdc++.h> using namespace std; int main(){ int l,r,x=0,y=0; cin >> l >> r; for(int i=l;i<=r;i++){ int a[11],top=0; int k=i; while(k){ a[++top]=k%2; k/=2; } int b=0,c=0; for(int i=1;i<=top;i++){ if(a[i]) b++; else c++; } if(b>c) x++; else y++; } cout << x << " " << y; return 0; }


测评信息: