Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
110521 | 王思颜 | 二进制转十进制 | C++ | Wrong Answer | 1 MS | 272 KB | 268 | 2025-02-22 11:16:00 |
#include<bits/stdc++.h> using namespace std; string a; int main() { cin>>a; int n = a.size(); int x,j = 0; for (int i = n - 1;i >= 0;i--){ if (a[i] == '1'){ x += 1 * pow(2,j); } else{ continue; } j++; } cout<<x; return 0; }
------Input------
111001111110000111111010111100
------Answer-----
972586684
------Your output-----
5931487