Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
110834 | 卢语涵 | 二进制转十进制 | C++ | Compile Error | 0 MS | 0 KB | 318 | 2025-02-23 14:34:43 |
#include<iostream> using namespace std; string s; int main (){ cin>>s; long long n=s.size(),a[32]; j=0; for(int i=n-1;i>=0;i--){ a[j]=int (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; }
Main.cc: In function 'int main()': Main.cc:7:5: error: 'j' was not declared in this scope j=0; ^ Main.cc:14:29: error: 'pow' was not declared in this scope ans=ans+a[i]*pow(2,i); ^