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;
}
};

【leetcode】Excel Sheet Column Title的更多相关文章

  1. 【leetcode】Excel Sheet Column Title & Excel Sheet Column Number

    题目描述: Excel Sheet Column Title Given a positive integer, return its corresponding column title as ap ...

  2. 【leetcode】Excel Sheet Column Title & Excel Sheet Column Number (easy)

    Given a positive integer, return its corresponding column title as appear in an Excel sheet. For exa ...

  3. 【leetcode】Excel Sheet Column Number

    Excel Sheet Column Number Related to question Excel Sheet Column Title Given a column title as appea ...

  4. 【LeetCode】Excel Sheet Column Number(Excel表列序号)

    这道题是LeetCode里的第171道题. 题目描述: 给定一个Excel表格中的列名称,返回其相应的列序号. 例如, A -> 1 B -> 2 C -> 3 ... Z -> ...

  5. [LeetCode] 168. Excel Sheet Column Title 求Excel表列名称

    Given a positive integer, return its corresponding column title as appear in an Excel sheet. For exa ...

  6. leetcode 168. Excel Sheet Column Title 171 Excel Sheet Column Number

    题目 //像10进制一样进行 转换   只是要从0开始记录 class Solution { public: string convertToTitle(int n) { char a; string ...

  7. LeetCode 168. Excel Sheet Column Title (Excel 表格列名称)

    Given a positive integer, return its corresponding column title as appear in an Excel sheet. For exa ...

  8. LeetCode 168. Excel Sheet Column Title

    Given a positive integer, return its corresponding column title as appear in an Excel sheet. -> A ...

  9. ✡ leetcode 168. Excel Sheet Column Title 26进制数字 --------- java

    Given a positive integer, return its corresponding column title as appear in an Excel sheet. For exa ...

随机推荐

  1. getAttribute和getParameter的区别

    2016年1月19日JSP中getParameter与getAttribute有何区别? ——getParameter得到的都是String类型的.或者是http://a.jsp?id=123中的12 ...

  2. css样式中遇到!important

    链接: http://zhidao.baidu.com/link?url=XyYHS2l-bFkzEgMBWfbQYuEV4vmGz8kOhj-jDL_HBqu0KnVIBQJKvw5OOO-bVjv ...

  3. Django动态下载文件

    前台提交查询条件,下载符合条件的EXCEL数据文件,后端视图中使用 xlwt 库来返回,如: objs = Units.objects.all() # 创建 Workbook 时,如果需要写入中文,请 ...

  4. Ubuntu 14 安装 Chrome/Chromium flash播放器

    在命令终端中执行如下命令即可: sudo apt-get install pepperflashplugin-nonfree sudo update-pepperflashplugin-nonfree ...

  5. Swift2.1 语法指南——高级操作符

    原档:https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programmi ...

  6. OpenCV imread读取图片,imshow展示图片,出现cv:Exception at memory location异常

    问题如上.环境:VS2013. 代码如下: #include "stdafx.h" #include "opencv2\opencv.hpp" using na ...

  7. C#利用Web Service实现短信发送(转)

    通过编程方式实现短信息的发送对很多人来说是一件比较烦杂的事情,目前一般的解决方法是通过计算机和手机的连线,通过可对手机编程的语言编写相关的手机短信息程序来实现,而这种方法对于一般人来说是很难达到的,因 ...

  8. lua操作json,mysql,redis等

    ==========================example for lua json======================= local cjson = require("cj ...

  9. tomcat JNDI 设置

    一.在Spring配置文件中的配置   <bean id="dataSource" class="org.springframework.jndi.JndiObje ...

  10. IoC模式

    1.依赖 依赖就是有联系,有地方使用到它就是有依赖它,一个系统不可能完全避免依赖.如果你的一个类或者模块在项目中没有用到它,恭喜你,可以从项目中剔除它或者排除它了,因为没有一个地方会依赖它.下面看一个 ...