| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 134995 | 胡海峰老师 | 十进制转R进制 | C++ | Accepted | 1 MS | 276 KB | 597 | 2025-11-02 09:22:16 |
#include <iostream> #include <string> using namespace std; string decimalToBase(int num, int base) { if (num == 0) return "0"; string result = ""; while (num > 0) { int remainder = num % base; if (remainder < 10) { result = char('0' + remainder) + result; } else { result = char('A' + (remainder - 10)) + result; } num /= base; } return result; } int main() { int X, R; cin >> X >> R; cout << decimalToBase(X, R) << endl; return 0; }