Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
97298 Yah123 二进制数问题 C++ Output Limit Exceeded 6 MS 264 KB 464 2024-11-12 17:40:57

Tests(0/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; cout<<a<<"\t"<<b<<"\t"<<c<<endl; }while(b!=0); if(totalO>totalZ){ totalA++; }else{ totalB++; } } cout<<totalA<<"\t"<<totalB<<endl; return 0; }