提交时间:2023-08-21 16:18:24
运行 ID: 99015
#include <iostream> #include <cstring> using namespace std; #define int long long char cha[16]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'}; int main(){ int k,n,l; while (cin >> k >> n >> l){ int a=1,t1=0; while (n>0){ t1+=n%10*a; n/=10,a*=k; } string ans = ""; while (t1!=0){ ans+=cha[t1%l]; t1/=l; } for (int i = ans.size()-1;i>=0;i--) cout << ans[i]; cout << endl; } }