Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
67430 冯诚阳 二进制转十进制 C++ Accepted 1 MS 284 KB 282 2024-03-16 15:30:29

Tests(20/20):


Code:

#include<iostream> #include<cstring> #include<cmath> using namespace std; int main(){ int a=0; char b[64]; cin>>b; int len=strlen(b); for(int i=0,j=len-1;i<len && j>=0;i++,j--){ a+=((b[j]-'0')*pow(2.0,i)); } cout<<a; return 0; }