0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-12-27 09:51:59 +00:00
OI-codes/Luogu/problem/B2143/B2143.cpp
2021-07-13 09:10:24 +08:00

30 lines
523 B
C++

#include <bits/stdc++.h>
using namespace std;
char itoc(int x) {
char r;
switch (x) {
case 10: r = 'A'; break;
case 11: r = 'B'; break;
case 12: r = 'C'; break;
case 13: r = 'D'; break;
case 14: r = 'E'; break;
case 15: r = 'F'; break;
default: r = x + '0'; break;
}
return r;
}
int main() {
string s, r;
int x, m;
cin >> x >> m;
while (x) {
r = itoc(x % m) + r;
x /= m;
}
cout << r << endl;
return 0;
}