实质为进制转换
#include<iostream>
#include<string>
using namespace std;
string cha(int num) {
char hi='0', lo='0';
if (num <=12) {
if (num <= 9) {
lo = num+'0';
}
else if (num == 10) {
lo = 'A';
}
else if (num == 11) {
lo = 'B';
}
else{
lo = 'C';
}
}
else {
if ((num/13) <= 9) {
hi = num / 13 + '0';
}
else if (num/13 == 10) {
hi= 'A';
}
else if (num/13 == 11) {
hi = 'B';
}
else {
hi = 'C';
}
if (num%13 <= 9) {
lo = num%13 + '0';
}
else if (num%13 == 10) {
lo = 'A';
}
else if (num%13 == 11) {
lo = 'B';
}
else {
lo = 'C';
}
}
string str = " ";
str[0] = hi;
str[1] = lo;
return str;
}
int main() {
string res1,res2,res3;
for (int i = 0; i < 3; i++) {
int num;
cin >> num;
if (i == 0) {
res1=cha(num);
}
if (i == 1) {
res2 = cha(num);
}
if (i == 2) {
res3 = cha(num);
}
}
cout <<'#'<<res1<<res2<<res3;
}