| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 69951 | 李星熠 | 二进制转十进制 | C++ | Accepted | 1 MS | 280 KB | 228 | 2024-04-12 19:02:18 |
#include<bits/stdc++.h> using namespace std; int main() { string s; cin>>s; int a = 1, ans = 0; for(int i = s.size() - 1; i >= 0; --i) { if(s[i] == '1') ans += a; a *= 2; } cout<<ans; return 0; }