Run ID:108039
提交时间: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; }