Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
141656 罗嘉为 十进制转d进制 C++ 通过 100 0 MS 244 KB 489 2024-04-06 09:29:43

Tests(10/10):


#include <bits/stdc++.h> using namespace std; stack<char> stk; char a[37] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}; int main(){ int n, d; cin >> n >> d; while(n){ stk.push(a[n % d]); n /= d; } if(stk.empty()){ cout << 0; } else { while(!stk.empty()){ cout << stk.top(), stk.pop(); } } return 0; }


测评信息: