zoukankan      html  css  js  c++  java
  • 数字转表格标题 Excel Sheet Column Title

    #include<string>
    using namespace std;
    class Solution {
    public:
       string convertToTitle(int n) {
             string res;
             if(n<=0) return "";
           while(n)
        {
          res+=(n-1)%26+'A';   //[n-1]这里一定要想明白了,注意头尾两个数据的验证
          n=(n-1)/26;
        }
        reverse(res.begin(),res.end());
        return res;
      }
    };

  • 相关阅读:
    hdu1066之数学题
    hdu1065计算几何
    hdu1060
    hdu1056
    appium安装说明
    LR安装说明
    网络编程
    读写excel
    dom
    HTML
  • 原文地址:https://www.cnblogs.com/julie-yang/p/4652775.html
Copyright © 2011-2022 走看看