AtlassianOA #4
Romanizer
Estimated EasyJudge-ready
Topics (AI-labelled)StringsBits & Math
Convert each positive integer into a standard uppercase Roman numeral, using the six subtractive forms IV, IX, XL, XC, CD, CM, and output them in input order.
Input
The first line contains n, and the second line contains n integers. The original lacks value bounds; this site adds 1≤n≤100000 and each number 1..3999; extensions that use overlines or repeated M to represent larger integers are not used.
Output
One Roman numeral string per line for each integer, n lines in total, with no count header.
Example 1
Input:
3
1 49 23
Output:
I
XLIX
XXIII
Example 2
Input:
6
4 9 40 90 400 900
Output:
IV
IX
XL
XC
CD
CM
Example 3
Input:
2
3888 3999
Output:
MMMDCCCLXXXVIII
MMMCMXCIX
Example notes
The outputs of the three public examples are, in order: I / XLIX / XXIII; IV / IX / XL / XC / CD / CM; MMMDCCCLXXXVIII / MMMCMXCIX. Verified by independent enumeration or direct simulation.
Editorial
Loading solution…