C ++中的Excel工作表列标题
让我们看下面的实现以更好地理解-
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
string convertToTitle(int n) {
string res;
while(n){
res += (--n)%26 + 'A';
n /= 26;
}
reverse(res.begin(), res.end());
return res;
}
};
main(){
Solution ob;
cout << (ob.convertToTitle(30));
}输入项
30
输出结果
AD
热门推荐
1 庆双节祝福语简短
4 合字的祝福语简短
10 新年祝福语长篇文案简短
11 简短大气的狗年祝福语
12 新婚贺词简短的祝福语
13 今日祝福语简短10字
14 雪后早晨简短的祝福语
15 捐款人留言祝福语简短
16 拜年啦祝福语大全简短
17 聚餐会祝福语简短
18 学生开学季祝福语简短