leetcode 168
168. Excel Sheet Column Title
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 给定一个正整数,返回它作为出现在Excel表中的正确列向标题。相当于26进制。
代码如下:
class Solution {
public:
string convertToTitle(int n) {
string ss;
while(n > )
{
ss = (char)(--n % + 'A') + ss;
n /= ;
}
return ss;
}
};
leetcode 168的更多相关文章
- LeetCode 168. Excel表列名称(Excel Sheet Column Title)
168. Excel表列名称 168. Excel Sheet Column Title 题目描述 给定一个正整数,返回它在 Excel 表中相对应的列名称. LeetCode168. Excel S ...
- LeetCode 168. Excel Sheet Column Title (Excel 表格列名称)
Given a positive integer, return its corresponding column title as appear in an Excel sheet. For exa ...
- [LeetCode] 168. Excel Sheet Column Title 求Excel表列名称
Given a positive integer, return its corresponding column title as appear in an Excel sheet. For exa ...
- Java实现 LeetCode 168 Excel表列名称
168. Excel表列名称 给定一个正整数,返回它在 Excel 表中相对应的列名称. 例如, 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -&g ...
- LeetCode 168. Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet. -> A ...
- ✡ 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 ...
- Leetcode 168 Excel Sheet Column Title 进制数转化
题意:将数字转化成excel表中的行中的项目 本质是10进制转化为26进制,但是在中间加入了一个不一样的操作,在每次操作前都需要n-- class Solution { public: string ...
- Java for LeetCode 168 Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet. For exa ...
- Java [Leetcode 168]Excel Sheet Column Title
题目描述: Given a positive integer, return its corresponding column title as appear in an Excel sheet. F ...
随机推荐
- SAP abap 需找出口(BADI)的几种方法
需找BADI方法有很多,据公司的牛人说,他知道的就不止5种 现在给出一些比较简单的方法 首先,大家要知道,一个程序的出口不会太多,需找出口,很多的时候都是在尝试 第二,方法:首先会给出事务码,然后通过 ...
- 黑马程序员——【Java基础】——Java IO流
---------- android培训.java培训.期待与您交流! ---------- 一.IO概述 1.IO:是Input.Output的缩写. 2.特点: (1)用于处理设备间的数据传输. ...
- Valgrind的多线程调试工具
Valgrind的多线程调试工具 Helgrind是Valgrind的一个重点功能 本节主要针对与多线程基本安全问题进行检测:[所有的代码环境都是在POSIX_THREAD模式下] 写线程代码时 经 ...
- Learning to write a compiler
http://stackoverflow.com/questions/1669/learning-to-write-a-compiler?rq=1 Big List of Resources: A N ...
- Python scikit-learn机器学习工具包学习笔记:feature_selection模块
sklearn.feature_selection模块的作用是feature selection,而不是feature extraction. Univariate feature selecti ...
- Visual Studio 启动修复命令
今天VS启动不了了,连命令行的 devenv.exe /? 都执行不了,看不到帮助命令了,记性不好,以前看过但没记住呀,还好我装了两个不同版本的VS, 另一个VS的帮助命令还是可以看到的.虽然修复了, ...
- VS2010环境下C++工程相关问题汇总
1.链接其他库调试时产生告警: warning LNK4099: 未找到 PDB“vc100.pdb” 解决方案:属性 -> C/C++ -> 输出文件 -> 程序数据库文件名 -& ...
- jQuery:获取浏览器中的分辨率
JQuery: <script type="text/javascript"> $(document).ready(function(){ alert($(window ...
- .net4缓存笔记
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...
- sql rollup解决责任人收支余额
问题的提出是周聪之前问过我的项目往来查询,不好在NC上一次性查询到.然后我就搞了一个很长的项目对账,发布了NC的节点. 现在我做了总二的总账,每次领导问我项目还有多少钱,收了多少付了多少,我还要通过科 ...