Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
108060 | 刘慕莀 | 十进制转二进制 | C++ | Accepted | 1 MS | 272 KB | 395 | 2025-01-19 14:19:28 |
#include <iostream> using namespace std; int main() { int a; cin >> a; if (a == 0) { cout << 0; return 0; } int b[32]; int c = 0; while (a > 0) { b[c] = a % 2; a = a / 2; c++; } for (int d = c - 1; d >= 0; d--) { cout << b[d]; } cout << endl; return 0; }