Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
110835 张之隽 二进制转十进制 C++ Runtime Error 0 MS 268 KB 274 2025-02-23 14:34:53

Tests(0/20):


Code:

#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+s[i]*pow(2, i); } cout<<ans; return 0; }


Run Info:

Runtime Error:Segmentation fault