Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
21
Task/Roman-numerals-Decode/FALSE/roman-numerals-decode.false
Normal file
21
Task/Roman-numerals-Decode/FALSE/roman-numerals-decode.false
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
[ 32| {get value of Roman digit on stack}
|
||||
$'m= $[\% 1000\]? ~[
|
||||
$'d= $[\% 500\]? ~[
|
||||
$'c= $[\% 100\]? ~[
|
||||
$'l= $[\% 50\]? ~[
|
||||
$'x= $[\% 10\]? ~[
|
||||
$'v= $[\% 5\]? ~[
|
||||
$'i= $[\% 1\]? ~[
|
||||
% 0
|
||||
]?]?]?]?]?]?]?
|
||||
]r:
|
||||
|
||||
0 {accumulator}
|
||||
^r;! {read first Roman digit}
|
||||
[^r;!$][ {read another, and as long as it is valid...}
|
||||
\$@@\$@@ {copy previous and current}
|
||||
\>[\_\]? {if previous smaller than current, negate previous}
|
||||
@@+\ {add previous to accumulator}
|
||||
]#
|
||||
%+. {add final digit to accumulator and output}
|
||||
10, {and a newline}
|
||||
Loading…
Add table
Add a link
Reference in a new issue