Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
110839 卢语涵 二进制转十进制 C++ Compile Error 0 MS 0 KB 322 2025-02-23 14:35:50

Tests(0/0):


Code:

#include<iostream> using namespace std; string s; long long a[32] int main (){ cin>>s; long long n=s.size(); 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,i); } cout<<ans; return 0; }


Run Info:

Main.cc:5:1: error: expected initializer before 'int'
 int main (){
 ^