提交时间:2023-08-21 16:26:16
运行 ID: 99041
#include <iostream> 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); else n+=char(tmp+48); } return n; } int main(){ band arr[1000]; int i=0; while(cin >> arr[i].k >> arr[i].n >> arr[i].l){cout << change(arr[i++]);} }