Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
147188 谢绍澜 二进制转十进制 C++ Wrong Answer 0 MS 268 KB 580 2026-02-03 15:47:17

Tests(0/20):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<vector> #include<set> #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int n,sum=0,s=1,f=0; cin>>n; for(int i=0;;i++){ if(n/10==0&&f==0){ sum+=n*1; break; } else{ f++; sum+=n%10*s;} n/=10; if(n==0) break; s*=2; } cout<<sum; return 0; }


Run Info:

------Input------
111001111110000111111010111100
------Answer-----
972586684
------Your output-----
2559