#Roman

LeetCode:12. Roman to Integer (Easy)

https://leetcode.com/problems/roman-to-integer/description/(1)将罗马数字转换成整数;(2)范围1-3999;  罗马数字相关规则已经在之前一篇博客里写过,这里不再赘述(之前博客的传送门)(1)这与之前第十二题Integer转换Roman虽...

LeetCode:12. Integer to Roman(Medium)

https://leetcode.com/problems/integer-to-roman/description/(1)将整数转换成罗马数字;(2)整数的范围1-3999 (1)对应整数罗马数字IVXLCDM对应整数1510501005001000   (2)罗马数字的书写规...

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 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

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