当前位置:网站首页>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)边栏推荐
- Sequence list and linked list
- Introduction to A-frame virtual reality development
- C library function int fprintf (file *stream, const char *format,...) Send formatted output to stream
- Meta metauniverse female safety problems occur frequently, how to solve the relevant problems in the metauniverse?
- 中电资讯-信贷业务数字化转型如何从星空到指尖?
- Oracle database knowledge points (IV)
- Gee: create a new feature and set corresponding attributes
- Mobile asynchronous sending SMS verification code solution -efficiency+redis
- 查询效率提升10倍!3种优化方案,帮你解决MySQL深分页问题
- Difference between value and placeholder
猜你喜欢

Since the "epidemic", we have adhered to the "no closing" of data middle office services

Analysis and solution of lazyinitializationexception

功能:求出菲波那契数列的前一项与后一项之比的极限的 近似值。例如:当误差为0.0001时,函数值为0.618056。

It's OK to have hands-on 8 - project construction details 3-jenkins' parametric construction

Use classname to modify style properties

Introduction to A-frame virtual reality development

Three layer switching ①
![Cesiumjs 2022^ source code interpretation [8] - resource encapsulation and multithreading](/img/d2/99932660298b4a4cddd7e5e69faca1.png)
Cesiumjs 2022^ source code interpretation [8] - resource encapsulation and multithreading

Who moved my code!

Luogu p1309 Swiss wheel
随机推荐
中电资讯-信贷业务数字化转型如何从星空到指尖?
Pratique technique | analyse et solution des défaillances en ligne (Partie 1)
C import Xls data method summary III (processing data in datatable)
Notice on Soliciting Opinions on the draft of information security technology mobile Internet application (APP) life cycle security management guide
Delete all elements with a value of Y. The values of array elements and y are entered by the main function through the keyboard.
be based on. NETCORE development blog project starblog - (14) realize theme switching function
机器学习基础:用 Lasso 做特征选择
MySQL uses the view to report an error, explain/show can not be issued; lacking privileges for underlying table
be based on. NETCORE development blog project starblog - (14) realize theme switching function
All in one 1407: stupid monkey
Some other configurations on Huawei's spanning tree
Luogu p1309 Swiss wheel
Oracle database knowledge points that cannot be learned (II)
How to use AHAS to ensure the stability of Web services?
Employees' turnover intention is under the control of the company. After the dispute, the monitoring system developer quietly removed the relevant services
Use classname to modify style properties
Network layer - routing
Swagger2 quick start and use
【.NET+MQTT】.NET6 环境下实现MQTT通信,以及服务端、客户端的双边消息订阅与发布的代码演示
Future source code view -juc series
https://leetcode-cn.com/problems/excel-sheet-column-title/