当前位置:网站首页>LeetCode 168. Detailed explanation of Excel list name
LeetCode 168. Detailed explanation of Excel list name
2022-07-04 01:27:00 【Vogelbaum】
I got to this simple difficult problem
At first glance, it's a hexadecimal conversion problem, but it's easy to fall into the pit .
First of all, let's talk about binary conversion ,
With 701 For example , This number can be converted into the following form :

1-26 Represent the A-Z, Use chr(65+x) You can easily convert numbers into symbols ,
But the question here is very stupid B The place is already obvious :
With simple division, you will only get 0, Can't get 26, Although it can also be judged by conditions, this formula can be converted into

Divide by each cycle 26, The number you get -1 Then divide the remainder to ensure that the number obtained is 0-25, Represent the A-Z
num = 701
string = ''
while num:
num -= 1
val = num%26
num -= val
num = int(num/26)
print(val)
string = chr(65+val) + string
print(string)边栏推荐
- About uintptr_ T and IntPtr_ T type
- How programmers find girlfriends through blind dates
- MySQL introduction - functions (various function statistics, exercises, details, tables)
- Solution of cursor thickening
- Function: find the approximate value of the limit of the ratio of the former term to the latter term of Fibonacci sequence. For example, when the error is 0.0001, the function value is 0.618056.
- Release and visualization of related data
- Network layer - routing
- Functions and arrays of shell scripts
- How can enterprises optimize the best cost of cloud computing?
- I don't care about you. OKR or KPI, PPT is easy for you
猜你喜欢

MySQL deadly serial question 2 -- are you familiar with MySQL index?

Three layer switching ①

Function: write function fun to find s=1^k+2^k +3^k ++ The value of n^k, (the cumulative sum of the K power of 1 to the K power of n).

Audio resource settings for U3D resource management

HackTheBox-baby breaking grad

A-Frame虚拟现实开发入门

Function: find the sum of the elements on the main and sub diagonal of the matrix with 5 rows and 5 columns. Note that the elements where the two diagonals intersect are added only once. For example,

Solution to the problem that jsp language cannot be recognized in idea

长文综述:大脑中的熵、自由能、对称性和动力学

Analysis and solution of lazyinitializationexception
随机推荐
MySQL - use of aggregate functions and group by groups
删除所有值为y的元素。数组元素中的值和y的值由主函数通过键盘输入。
PMP 考试常见工具与技术点总结
Logical operator, displacement operator
How to set the response description information when the response parameter in swagger is Boolean or integer
Print diamond pattern
基于.NetCore开发博客项目 StarBlog - (14) 实现主题切换功能
Conditional test, if, case conditional test statements of shell script
Customize redistemplate tool class
Special copy UML notes
All in one 1407: stupid monkey
In the process of seeking human intelligent AI, meta bet on self supervised learning
[turn] solve the problem of "RSA public key not find" appearing in Navicat premium 15 registration
be based on. NETCORE development blog project starblog - (14) realize theme switching function
C import Xls data method summary II (save the uploaded file to the DataTable instance object)
C import Xls data method summary III (processing data in datatable)
Weekly open source project recommendation plan
TP5 automatic registration hook mechanism hook extension, with a complete case
查询效率提升10倍!3种优化方案,帮你解决MySQL深分页问题
基于.NetCore开发博客项目 StarBlog - (14) 实现主题切换功能
https://leetcode-cn.com/problems/excel-sheet-column-title/