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
Credits...
分类:
其他好文 时间:
2014-12-22 19:40:49
阅读次数:
151
/*-----------------------------------------------------------------------------Prototype Style Sheet (empty commented stylesheet)version: 1.0author:.....
分类:
Web程序 时间:
2014-12-22 12:31:49
阅读次数:
165
转载地址:http://www.w3cplus.com/tools/emmet-cheat-sheet.html 介绍 Emmet (前身为 Zen Coding) 是一个能大幅度提高前端开发效率的一个工具: 基本上,大多数的文本编辑器都会允许你存储和重用一些代码块,我们称之为“片段...
分类:
其他好文 时间:
2014-12-22 09:19:35
阅读次数:
422
1、题目Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 2...
分类:
其他好文 时间:
2014-12-21 19:18:21
阅读次数:
180
leetcode新題,Excel Sheet Column Title,本質是進制轉化,難度easy。excel中的序是这样排的:A~Z,AA~ZZ,AAA~ZZZ.......
本质是进制转换,将n转化为26进制,转化过程如下(括号里的是26进制数):
1->(1)->A
2->(2)->B
...
26->(10)->Z
27->(11)->AA
28->(12)->AB
.....
52->(20)->AZ
53->(21)->BA
因此可以将n转化为26进制表示的数,然后对每一位的数,根据『1->...
分类:
其他好文 时间:
2014-12-21 14:01:36
阅读次数:
386
class Solution {public: string convertToTitle(int n) { if (n 0) { n--; res = (char)(n % 26 + 'A') + res; n ...
分类:
其他好文 时间:
2014-12-21 13:56:49
阅读次数:
219
Excel Sheet Column TitleGiven a non-zero positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A ...
分类:
其他好文 时间:
2014-12-21 00:44:20
阅读次数:
284
就是个26进制class Solution {public: string convertToTitle(int n) { string ans = ""; while(n) { ans = string(1, ((n - 1) % 26 + ...
分类:
其他好文 时间:
2014-12-20 23:24:54
阅读次数:
194
Excel Sheet Column TitleGiven a non-zero positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A ...
分类:
其他好文 时间:
2014-12-20 22:07:17
阅读次数:
233
Excel Sheet Column TitleGiven a non-zero positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A ...
分类:
其他好文 时间:
2014-12-20 19:38:27
阅读次数:
242