168. Excel Sheet Column Title
来源:互联网 发布:淘宝如何使用分期付款 编辑:程序博客网 时间:2024/06/01 09:09
Given a 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
class Solution {public: string convertToTitle(int n) { string str; int carry = 0; int result = 0; char c[2]; c[1] = '\0'; while(n>26){ carry = n%26; if(carry == 0){ c[0] = 'Z'; n = n-26; }else{ c[0] = carry + 'A'-1; } str = string(c) + str; n = n/26; } if(n!=0){ c[0] = n + 'A' - 1; str = string(c) + str; } return str; }};
阅读全文
0 0
- 168. Excel Sheet Column Title
- 168. Excel Sheet Column Title
- 168. Excel Sheet Column Title
- 168. Excel Sheet Column Title
- 168. Excel Sheet Column Title
- 168. Excel Sheet Column Title
- 168. Excel Sheet Column Title
- 168. Excel Sheet Column Title
- 168. Excel Sheet Column Title
- 168. Excel Sheet Column Title
- 168. Excel Sheet Column Title
- 168. Excel Sheet Column Title
- 168. Excel Sheet Column Title
- 168. Excel Sheet Column Title
- 168. Excel Sheet Column Title
- 168. Excel Sheet Column Title
- 168. Excel Sheet Column Title *
- 168. Excel Sheet Column Title
- Lintcode119 Edit Distance solution 题解
- tomcat1.8,tomcat-users.xml文件中如下修改才可以使用app manager登录,其中的roles有哪些枚举需要确认
- HDU
- kotlin学习笔记1
- html+js日历
- 168. Excel Sheet Column Title
- 数据库基本操作
- mybatis一级二级缓存
- iOS【开发之 APP自定义换肤、主题更换】
- 制造业从中国回流英国 英媒:工业史上的奇妙反转
- iOS 用symbolicatecrash来符号化崩溃日志
- fatal: Unable to find remote helper for 'https'
- JSON初识
- pat1001