Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
158058 袁昊贝 二进制数问题 C++ Runtime Error 0 MS 248 KB 627 2026-08-20 15:38:27

Tests(0/1):


Code:

#include <bits/stdc++.h> using namespace std; int main(){ int A=0,B=0; for (int i=1;i<=1000;i++){ int num=i; string s=""; while (num>0){ s=s+char(num%A+'0'); num/=2; } reverse(s.begin(),s.end()); int s0=0,s1=0; for (int j=0;j<s.length();j++){ if (s[j]=='0'){ s0++; } else{ s1++; } } if (s1>s0){ A++; } else{ B++; } } cout<<A<<" "<<B<<endl; return 0; }


Run Info:

Runtime Error:Floating point exception