提交时间:2023-08-21 23:30:40

运行 ID: 99099

#include <iostream> #include <cmath> using namespace std; struct band{ int k,n,l; }; int B(int n,int b){ int s=0,t=0; while(n){ s += n%10*pow(b,t); t++; n /= 10; } return s; } string change(band x){ string n = ""; int s = B(x.n,x.k),tmp; while(s){ tmp = s%x.l; if(tmp>9) n=char(tmp+55)+n; else n=char(tmp+48)+n; s /= x.l; } return n; } int main(){ band x; cin >> x.k >> x.n >> x.l; cout << change(x); return 0; }