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
热门推荐
7 建队节祝福语简短
10 广场周年庆祝福语 简短
11 升班祝福语简短10字
12 给妈妈祝福语简短内容
13 简短新年红包祝福语大全
14 中考考后祝福语简短
15 送给客人简短的祝福语
16 晚辈给长辈祝福语简短
17 文艺乔迁祝福语简短精辟
18 部门过年祝福语简短独特