题目描述
小明用字母A 对应数字1,B 对应2,以此类推,用Z 对应26。对于27以上的数字
小明用两位或更长位的字符串来对应,例如AA 对应27,AB 对应28,AZ 对应52,LQ 对应329。
请问2019 对应的字符串是什么?
#include <iostream>
#include <algorithm>
using namespace std;
void solve(int x) {
if(x == 0) return;
solve(x / 26);
cout << char('A' + x % 26 - 1);
}
int main() {
solve(2019);
return 0;
}