deno.land / x / masx200_leetcode_test@10.6.5 / integer-to-roman / index.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
export default function intToRoman(num: number): string { return [ M[Math.floor((num / 1000) % 10)], C[Math.floor((num / 100) % 10)], X[Math.floor((num / 10) % 10)], I[Math.floor(num % 10)], ].join("");}const M = ["", "M", "MM", "MMM"]; //# 1000,2000,3000const C = ["", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"]; //# 100~900const X = ["", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"]; //# 10~90const I = ["", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"]; //# 1~9
masx200_leetcode_test
leetcode题解和一些测试工具
DocumentationDocumentation
GitHub Repositorymasx200/leetcode-test
GitHub Stars
4

Version Info

Tagged at
4 months ago