当前位置:网站首页>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)边栏推荐
- 技術實踐|線上故障分析及解决方法(上)
- Openbionics robot project introduction | bciduino community finishing
- Summary of JWT related knowledge
- [common error] UART cannot receive data error
- Introduction to superresolution
- 2020-12-02 SSM advanced integration Shang Silicon Valley
- A little understanding of GSLB (global server load balance) technology
- Cloud dial test helps Weidong cloud education to comprehensively improve the global user experience
- 数据库表外键的设计
- be based on. NETCORE development blog project starblog - (14) realize theme switching function
猜你喜欢

SRCNN:Learning a Deep Convolutional Network for Image Super-Resolution

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

【.NET+MQTT】.NET6 环境下实现MQTT通信,以及服务端、客户端的双边消息订阅与发布的代码演示

Cloud dial test helps Weidong cloud education to comprehensively improve the global user experience

0 basic learning C language - nixie tube dynamic scanning display

Mobile asynchronous sending SMS verification code solution -efficiency+redis
![[turn] solve the problem of](/img/c2/368582a8ed26254409fe391899ba41.jpg)
[turn] solve the problem of "RSA public key not find" appearing in Navicat premium 15 registration

中电资讯-信贷业务数字化转型如何从星空到指尖?

@EnableAsync @Async

1-Redis架构设计到使用场景-四种部署运行模式(上)
随机推荐
2020-12-02 SSM advanced integration Shang Silicon Valley
Ka! Why does the seat belt suddenly fail to pull? After reading these pictures, I can't stop wearing them
我管你什么okr还是kpi,PPT轻松交给你
Network layer - routing
Query efficiency increased by 10 times! Three optimization schemes to help you solve the deep paging problem of MySQL
A little understanding of GSLB (global server load balance) technology
在寻求人类智能AI的过程中,Meta将赌注押向了自监督学习
“疫”起坚守 保障数据中台服务“不打烊”
Design of database table foreign key
使用dnSpy对无源码EXE或DLL进行反编译并且修改
mysql使用视图报错,EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
C import Xls data method summary I (upload files and create Workbooks)
ES6 deletes an attribute in all array objects through map, deconstruction and extension operators
C import Xls data method summary III (processing data in datatable)
Trading software programming
中电资讯-信贷业务数字化转型如何从星空到指尖?
1-redis architecture design to use scenarios - four deployment and operation modes (Part 1)
Oracle database knowledge points that cannot be learned (II)
Huawei rip and BFD linkage
Who moved my code!
https://leetcode-cn.com/problems/excel-sheet-column-title/