Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
79552 | Kevin | 二进制转十进制 | C++ | Accepted | 1 MS | 276 KB | 230 | 2024-07-08 14:34:57 |
#include <bits/stdc++.h> using namespace std; int main() { char b[64]; int ans=0; gets(b); int len=strlen(b); for(int i=0,j=len-1;i<len,j>=0;i++,j--){ ans+=((b[j]-'0')*pow(2,i)); } cout<<ans; return 0; }