LeetCode Excel Sheet Column Title

class Solution {
public:
    string convertToTitle(int n) {
        if (n <= 0) {
            return "";
        }
        string res;
        while (n>0) {
            n--;
            res = (char)(n % 26 + 'A') + res;
            n /= 26;
        }
        return res;
    }
};

有些理不清,没有零的数进制,应该还是算第几个排列类型的

原文地址:https://www.cnblogs.com/lailailai/p/4176390.html