当前位置:网站首页>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
- Introduction to superresolution
- Mobile asynchronous sending SMS verification code solution -efficiency+redis
- Special copy UML notes
- 我管你什么okr还是kpi,PPT轻松交给你
- All in one 1407: stupid monkey
- Fundamentals of machine learning: feature selection with lasso
- 【.NET+MQTT】. Net6 environment to achieve mqtt communication, as well as bilateral message subscription and publishing code demonstration of server and client
- C import Xls data method summary III (processing data in datatable)
- MySQL - use of aggregate functions and group by groups
猜你喜欢

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

Analysis and solution of lazyinitializationexception

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

Mobile asynchronous sending SMS verification code solution -efficiency+redis

How to delete MySQL components using xshell7?

Use classname to modify style properties

String hash, find the string hash value after deleting any character, double hash

GUI 应用:socket 网络聊天室

TP5 automatic registration hook mechanism hook extension, with a complete case

Solution of cursor thickening
随机推荐
51 single chip microcomputer timer 2 is used as serial port
Three layer switching ①
In the process of seeking human intelligent AI, meta bet on self supervised learning
Delete all elements with a value of Y. The values of array elements and y are entered by the main function through the keyboard.
基于.NetCore开发博客项目 StarBlog - (14) 实现主题切换功能
Technical practice online fault analysis and solutions (Part 1)
Who moved my code!
2020-12-02 SSM advanced integration Shang Silicon Valley
Gnupg website
Which insurance products can the elderly buy?
Force deduction solution summary 1189- maximum number of "balloons"
be based on. NETCORE development blog project starblog - (14) realize theme switching function
MySQL introduction - functions (various function statistics, exercises, details, tables)
AI 助力艺术设计抄袭检索新突破!刘芳教授团队论文被多媒体顶级会议ACM MM录用
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).
I don't care about you. OKR or KPI, PPT is easy for you
About uintptr_ T and IntPtr_ T type
Idsia & supsi & usi | continuous control behavior learning and adaptive robot operation based on Reinforcement Learning
Openbionics exoskeleton project introduction | bciduino community finishing
技术实践|线上故障分析及解决方法(上)
https://leetcode-cn.com/problems/excel-sheet-column-title/