Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
108039 | 刘慕莀 | 十进制转二进制 | C++ | Wrong Answer | 1 MS | 272 KB | 500 | 2025-01-19 14:12:30 |
#include <iostream> using namespace std; int main() { int a; cin >> a; if (a == 0) { cout << 0; return 0; } int b = 0; int c = 1; while (a > 0) { int d = a % 2; b = b + d * c; c *= 10; a = a / 2; } // Output the reversed binary number in correct order int e = b; while (e > 0) { cout << e % 10; e /= 10; } cout << endl; return 0; }
------Input------
972586684
------Answer-----
111001111110000111111010111100
------Your output-----