文件名称:java猜字母游戏源码-AlgoNotes:算法笔记本
文件大小:164KB
文件格式:ZIP
更新时间:2024-06-24 21:50:19
系统开源
java猜字母游戏源码 AlgoNotes Algo笔记本, 用来记录一下平时刷LeetCode的 题目12:数字转换罗马数字 日期: 2020-7-15 题目描述: 题解:(Python) class Solution: def intToRoman(self, num: int) -> str: digits = [(1000, "M"), (900, "CM"), (500, "D"), (400, "CD"), (100, "C"), (90, "XC"), (50, "L"), (40, "XL"), (10, "X"), (9, "IX"), (5, "V"), (4, "IV"), (1, "I")] roman_digits = [] for value,symbol in digits: if num == 0: break count, num = divmod(num, value) roman_digits.append(symbol * count) return "".join(roman_digits) 需要的函数: divmod(被除数,除数), 返回的
【文件预览】:
AlgoNotes-master
----.history()
--------README_20200722093402.md(5KB)
--------README_20200722110324.md(6KB)
--------README_20200722110323.md(6KB)
----README.md(9KB)
----img()
--------12-1.jpg(58KB)
--------12-2.jpg(120KB)