rt
使用栈,悬关
#include<bits/stdc++.h>
#define returnO_o return 0
#define loser long long
using namespace std;
int a,b,x,y,idx;
string n;
string bk="0123456789ABCDEFG";
stack<char>dq;
int main(){
cin>>a>>n>>b;
y=n.size();
idx=pow(a,y-1);
for(int i=0;i<y;i++,idx/=a) x+=bk.find(n[i])*idx;
dq.push(bk[x%b]);
while(x!=1){
x/=b;
dq.push(bk[x%b]);
}
while(!dq.empty()){
cout<<dq.top();
dq.pop();
}
returnO_o;
}