提交时间:2024-01-02 13:17:48
运行 ID: 118885
#include<bits/stdc++.h> using namespace std; const string s="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; int n,d; stack<char>t; void tox(int x) { if(!(x/d)) { t.push(s[x]); return; } t.push(s[x%d]); tox(x/d); } int main() { cin>>n>>d; tox(n); while(!t.empty()) { cout<<t.top(); t.pop(); } return 0; }