Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
16
Task/Roman-numerals-Decode/SPL/roman-numerals-decode.spl
Normal file
16
Task/Roman-numerals-Decode/SPL/roman-numerals-decode.spl
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
r2a(r)=
|
||||
n = [1,5,10,50,100,500,1000]
|
||||
a,m = 0
|
||||
> i, #.size(r)..1, -1
|
||||
v,c = n[#.pos("IVXLCDM",#.mid(r,i))]
|
||||
? v<m, v = -v
|
||||
? c>m, m = c
|
||||
a += v
|
||||
<
|
||||
<= a
|
||||
.
|
||||
|
||||
t = ["MMXI","MIM","MCMLVI","MDCLXVI","XXCIII","LXXIIX","IIIIX"]
|
||||
> i, 1..#.size(t,1)
|
||||
#.output(t[i]," = ",r2a(t[i]))
|
||||
<
|
||||
Loading…
Add table
Add a link
Reference in a new issue