提交时间:2024-04-06 09:18:39
运行 ID: 141638
#include<iostream> #include<cstdio> #include<stack> using namespace std; stack<int> stk; int main() { int d; long long n; cin>>n>>d; while(n) { stk.push(n%d); n/=d; } if(stk.empty()) cout<<0; //while(!stk.empty()) //{ // cout<<stk.top()<<" "; // stk.pop(); //} //cout<<(char)(15-'0'+'A')<<endl; while(!stk.empty()) { int x=stk.top(); stk.pop(); if(x>=10) cout<<(char)(x-10+'A'); else cout<<x; } return 0; }