Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
110855 | 尚雨钒 | 二进制转十进制 | C++ | Wrong Answer | 1 MS | 264 KB | 273 | 2025-02-23 14:44:40 |
#include<bits/stdc++.h> using namespace std; string s; int a[32]; int main(){ cin>>s; int n=s.size(); int j=0; for(int i=n-1;i>=0;i--){ a[j]=s[i]-48; j++; } int ans=0; for(int i=0;i<n;i++){ ans=ans+a[i]*pow(2,1); } cout<<ans; return 0; }
------Input------
111001111110000111111010111100
------Answer-----
972586684
------Your output-----
40