最后一个数据错了
#include<bits/stdc++.h>
using namespace std;
int n, s,m;
char a[20] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}, b[15];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n>>m;
while (n != 0) {
b[s] = a[n % m];
n /= m;
s++;
}
for (int i = s - 1; i >= 0; i--) {
cout << b[i];
}
return 0;
}