Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
122541 吴天辰 二进制转十进制 C++ Compile Error 0 MS 0 KB 245 2025-06-21 11:04:07

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ char a[64]; cin>>a; int len=strlen(a); int sum=0; for(int i=0,j=len-1;i<len,j>=0;i++,j--) { sum+=((a[j]-"0")*pow(2,i)); } cout<<sum; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:8:25: warning: left operand of comma operator has no effect [-Wunused-value]
    for(int i=0,j=len-1;i=0;i++,j--)
                         ^
Main.cc:10:17: error: invalid operands of types 'char' and 'const char [2]' to binary 'operator-'
     sum+=((a[j]-"0")*pow(2,i));
                 ^