提交时间:2024-04-12 22:38:57
运行 ID: 143118
#include<iostream> #include<stack> using namespace std; stack<char> s; char to(int x){ if(x>=0 && x<=9){ return char(x+'0'); }else{ return char('A'+(x-10)); } } int main(){ int n,d; cin>>n>>d; do{ s.push(to(n%d)); n /= d; }while(n > 0); while(!s.empty()){ cout<<s.top(); s.pop(); } return 0; }