51
Dev开发社区
首页
文章
问答
工具
搜索
登录
注册
#Roman
LeetCode:12. Roman to Integer (Easy)
https://leetcode.com/problems/roman-to-integer/description/(1)将罗马数字转换成整数;(2)范围1-3999; 罗马数字相关规则已经在之前一篇博客里写过,这里不再赘述(之前博客的传送门)(1)这与之前第十二题Integer转换Roman虽...
代码星球
·
2021-02-12
LeetCode
Roman
to
Integer
Easy
LeetCode:12. Integer to Roman(Medium)
https://leetcode.com/problems/integer-to-roman/description/(1)将整数转换成罗马数字;(2)整数的范围1-3999 (1)对应整数罗马数字IVXLCDM对应整数1510501005001000 (2)罗马数字的书写规...
代码星球
·
2021-02-12
LeetCode
Integer
to
Roman
Medium
leetcode 13 -> Roman to Integer
classSolution(object):defromanToInt(self,s):""":types:str:rtype:int"""lista={'I':1,'V':5,'X':10,'L':50,'C':100,'D':500,'M':1000}Value_sum=0last_Value=0for...
代码星球
·
2020-08-09
leetcode
Roman
to
Integer
leetcode 12 -> Integer to Roman
classSolution(object):defintToRoman(self,num):""":typenum:int:rtype:str"""ifnum==0:return""ifnum>=1000:return"M"+self.intToRoman(num-1000)elifnum>=9...
代码星球
·
2020-08-09
leetcode
Integer
to
Roman
12. Integer to Roman
defsolution(num):if(0<num<=5):if(num<4):return(num)*"I"else:return(5-num)*"I"+"V"elif(5<num<=10):return"V"+(num-5)*"I"elif(10<num<=50...
代码星球
·
2020-08-09
Integer
to
Roman
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他