Excel Sheet Column Title
Given a non-zero positive integer, return its corresponding column title as appear in an Excel sheet.
For example:
1 -> A
2 -> B
3 -> C
...
26 -> Z
27 -> AA
28 -> AB
类似于数制转换,只不过1对应A,而不是0对应A
class Solution {
public:
string convertToTitle(int n) { string res=""; while(n>)
{
int tmp=(n-)%;
res.push_back('A'+tmp); n=(n-)/;
} string result(res.rbegin(),res.rend());
return result;
}
};