Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
971 | 张宸瑞 | 二进制转十进制 | C++ | Accepted | 0 MS | 268 KB | 263 | 2023-06-10 15:23:18 |
#include <iostream> #include <cmath> #include <string> using namespace std; string s; int main() { cin>>s; int n=0,max=1; for(int i=s.size()-1;i>=0;i--){ n+=(s[i]-'0')*max; max=max*2; } cout<<n; return 0; }