标签:title exce ret -- ems res column excel int
class Solution {
public:
string convertToTitle(int n) {
string ans="";
while(n)
{
int x = (n-1) % 26;
ans += ('A'+ x );
n = (n-1) / 26;
}
string res="";
for(int i=ans.length()-1;i>=0;i--)
{
res += ans[i];
}
return res;
}
};
LeetCode 168. Excel Sheet Column Title
标签:title exce ret -- ems res column excel int
原文地址:https://www.cnblogs.com/dacc123/p/12236062.html