标签:
class Solution(object): def intToRoman(self, num): """ :type num: int :rtype: str """ M=["","M","MM","MMM"] C=["","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"] X=["","X","XX","XXX","XL","L","LX","LXX","LXXX","XC"] I=["","I","II","III","IV","V","VI","VII","VIII","IX"] return M[num/1000]+C[(num%1000)/100]+X[(num%100)/10]+I[(num%10)]
Leetcode 12. Integer to Roman(python)
标签:
原文地址:http://www.cnblogs.com/colorss/p/5355083.html