public class Solution {
private string Convert(int k)
{
var s = "";
switch (k)
{
case :
s = "A";
break;
case :
s = "B";
break;
case :
s = "C";
break;
case :
s = "D";
break;
case :
s = "E";
break;
case :
s = "F";
break;
case :
s = "G";
break;
case :
s = "H";
break;
case :
s = "I";
break;
case :
s = "J";
break;
case :
s = "K";
break;
case :
s = "L";
break;
case :
s = "M";
break;
case :
s = "N";
break;
case :
s = "O";
break;
case :
s = "P";
break;
case :
s = "Q";
break;
case :
s = "R";
break;
case :
s = "S";
break;
case :
s = "T";
break;
case :
s = "U";
break;
case :
s = "V";
break;
case :
s = "W";
break;
case :
s = "X";
break;
case :
s = "Y";
break;
case :
s = "Z";
break;
}
return s;
} public string ConvertToTitle(int n)
{
var list = new List<int>();
while (n != )
{
var k = n % ;
list.Add(k);
if (k == )
{
n = n / - ;
}
else
{
n = n / ;
}
} list.Reverse(); StringBuilder sb = new StringBuilder();
for (int i = ; i < list.Count; i++)
{
var s = Convert(list[i]);
sb.Append(s);
}
return sb.ToString();
}
}

https://leetcode.com/problems/excel-sheet-column-title/#/description

leetcode168的更多相关文章

  1. [Swift]LeetCode168. Excel表列名称 | Excel Sheet Column Title

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

  2. LeetCode168.Excel表列名称

    给定一个正整数,返回它在 Excel 表中相对应的列名称. 例如, 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> ...

  3. leetcode-168周赛-1297-子串的最大出现次数

    题目描述: 自己的提交: class Solution: def maxFreq(self, s: str, maxLetters: int, minSize: int, maxSize: int) ...

  4. leetcode-168周赛-1298-你能从盒子中获得的最大糖果数

    题目描述: 方法一:bfs class Solution: def maxCandies(self, status: List[int], candies: List[int], keys: List ...

  5. leetcode-168周赛-1295-统计位数为偶数的数字

    题目描述: 方法一:O(N) class Solution: def findNumbers(self, nums: List[int]) -> int: ans=0 for num in nu ...

  6. leetcode-168周赛-1296-划分数字为连续数字的集合

    题目描述: 自己的提交: class Solution: def isPossibleDivide(self, nums: List[int], k: int) -> bool: c = col ...

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

    168. Excel表列名称 168. Excel Sheet Column Title 题目描述 给定一个正整数,返回它在 Excel 表中相对应的列名称. LeetCode168. Excel S ...

随机推荐

  1. 程序设计入门-C语言基础知识-翁恺-第三周:循环-详细笔记(三)

    目录 第三周:循环 3.1 循环 3.2 循环计算 3.3 课后习题 3.4 讨论题(不需要掌握) 第三周:循环 3.1 循环 while循环 语法: while(条件表达式){ //循环体语句 } ...

  2. three.js中点生成矩阵方法

    正常情况用threejs 点生成matrix4,方法为: 例如生成饶Y轴旋转的矩阵我们要的结果为: [cos, 0, -sin, 0,  0,  1,   0, 0, sin,  0,   cos, ...

  3. threeJs中旋转位移等操作坐标系

    1.场景中的立方体.圆柱等三维模型的位置属性.平移方法参照Scene对象的世界坐标系 2.场景中立方体.圆柱等的三维模型的角度属性.旋转方法参照模型自身的模型坐标系

  4. POJ1733 Parity game 【带权并查集】*

    POJ1733 Parity game Description Now and then you play the following game with your friend. Your frie ...

  5. 使用 GitVersion 在编译或持续构建时自动使用语义版本号(Semantic Versioning)

    我们在之前谈过 语义版本号(Semantic Versioning),在项目中应用语义版本号能够帮助库的开发者在发布包时表明更多的语义信息.这是趋势,从微软的博客 Versioning NuGet p ...

  6. 同一台电脑上装两个或两个以上的tomcat服务器

    1.下载免安装版tomcat,解压成tomcat1.tomcat2: 2.修改tomcat2中conf下server.xml文件如下: <Server port="8005" ...

  7. drill 表&&视图使用

    1.  table    create table table_name as select * from storage_name.dbname.tablename   2. view   crea ...

  8. Cucumber 之Gherkin

     1.Gherkin简介: Cucumber是一个解释程序,就像ruby命令执行解释 .rb文件里的Ruby代码一样,Cucumber用来执行解释 .feature文件里的Gehrkin代码. 2. ...

  9. 在linux修改文件夹及其子文件夹的权限。

    加入-R 参数,就可以将读写权限传递给子文件夹例如chmod -R 777 /home/mypackage那么mypackage 文件夹和它下面的所有子文件夹的属性都变成了777.777是读.写.执行 ...

  10. c/c++指针详解(二)

    指针的概念 指针是一个特殊的变量,它里面存储的数值被解释成为内存里的一个地址.要搞清一个指针需要搞清指针的四方面的内容:指针的类型,指针所指向的类型,指针的值或者叫指针所指向的内存区,还有指针本身所占 ...