Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
97299 Yah123 二进制数问题 C++ Accepted 1 MS 268 KB 427 2024-11-12 17:41:38

Tests(1/1):


Code:

#include<iostream> using namespace std; int main(){ int a,b,c,i; int totalZ,totalO,totalA,totalB; totalA=0; totalB=0; for(i=1;i<=1000;i++){ a=i; totalZ=0; totalO=0; do{ b=a/2; c=a%2; if(c == 0){ totalZ++; }else{ totalO++; } a=b; }while(b!=0); if(totalO>totalZ){ totalA++; }else{ totalB++; } } cout<<totalA<<"\t"<<totalB<<endl; return 0; }