9/4/2023 0 Comments Roman numeral ivi![]() ![]() ![]() # (after the filter, the result is output implicitly) Q # And check if it's equal to the (implicit) input-pair Ø # Zip/transpose so we have inner lists of top/bottom values È # Index those into the list of pairs (with automatic wrap-around) Ç # Convert its characters to their unicode valuesĨ7% # Take modulo-87 for each (I=73 V=86 X=1 L=76 C=67 D=68 M=77) S # Swap to get the current Roman number we're filtering on X # Convert each integer to a Roman numberĤв # Convert it to base-4 as list: 7 bytes thanks to it online or verify all test cases.Įxplanation: žD # Push builtin 4096 (the maximum Roman number is 3999) This is a usual code-golf, and needless to say, I'm interested to see how golf languages implement roman numeral counting rules. (note that IIC, and IID are not valid numbers. Output: III, IX, XI, LV, XC, CII, CX, CCI, CCC, DII, DX, DCI, DCC (note that DD is not a valid roman numeral, and thus should not be outputted, the value of all of these is (in order) 2, 10, 99, 101, 499, 501) Your job is to take in 2 numbers, which represent the number of intersections on the top and bottom of your line (in that order), and output all possible valid combinations of roman numerals, from smallest by literal value to largest. The value of all roman numerals is as follows:Īnd the number of intersections (top, bottom) is: For example: I, or 1 intersects both the top and bottom of the line, and V or 5 intersects the bottom and top lines, the top twice and the bottom at one place. Roman numerals can be (mostly) written in a one column format, because each letter intersects the top and the bottom of the line. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |