integer to roman

Solution) class Solution: def intToRoman(self, num: int) -> str: # Initialization dic = {1000:'M', 500:'D', 100:'C', 50:'L', 10:'X', 5:'V', 1:'I'} res = "" digit = 1 # while num > 0 while num: # Current digit integer's string variable cur = "" # Get a remainder, but with its zeros remainder = num % (digit*10) # Update num beforehand num -= remainder # If remainder = 4, 9, 40, 90, 400, 900 if rem..
위대한먼지
'integer to roman' 태그의 글 목록