Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
15
Task/Roman-numerals-Encode/11l/roman-numerals-encode.11l
Normal file
15
Task/Roman-numerals-Encode/11l/roman-numerals-encode.11l
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
V anums = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
|
||||
V rnums = ‘M CM D CD C XC L XL X IX V IV I’.split(‘ ’)
|
||||
|
||||
F to_roman(=x)
|
||||
V ret = ‘’
|
||||
L(a, r) zip(:anums, :rnums)
|
||||
(V n, x) = divmod(x, a)
|
||||
ret ‘’= r * n
|
||||
R ret
|
||||
|
||||
V test = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 25, 30, 40,
|
||||
50, 60, 69, 70, 80, 90, 99, 100, 200, 300, 400, 500, 600, 666, 700, 800, 900, 1000,
|
||||
1009, 1444, 1666, 1945, 1997, 1999, 2000, 2008, 2010, 2011, 2500, 3000, 3999]
|
||||
L(val) test
|
||||
print(val‘ - ’to_roman(val))
|
||||
Loading…
Add table
Add a link
Reference in a new issue