就是数学题,找规律就完事了
class Solution {
public:
string convertToTitle(int n) {
string res("");
while(n > 0){
int a = (n-1) % 26 + 1;
n = (n-1)/26;
res = char('A'+a-1) + res;
}
return res;
}
};