Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
110534 揭伟琦 二进制转十进制 C++ Runtime Error 0 MS 288 KB 271 2025-02-22 11:29:18

Tests(0/20):


Code:

#include<bits/stdc++.h> using namespace std; string a; int s[23]; int main() { cin >>a; int n=a.size(); int j=0; for(int i=n-1;i>=0;i--) { s[j]=a[i]-48; j++; } int b=0; for(int i=0;i<n;i++){ b=b+pow(2,i)*s[i]; } cout <<b; return 0; }


Run Info:

Runtime Error:Segmentation fault