cswork / OA打开练习工作台

AtlassianOA #4

Romanizer

估计简单可在线判题

考点(AI 标注)字符串位运算

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.

输入格式

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.

输出格式

One Roman numeral string per line for each integer, n lines in total, with no count header.

样例 1

输入:

3
1 49 23

输出:

I
XLIX
XXIII

样例 2

输入:

6
4 9 40 90 400 900

输出:

IV
IX
XL
XC
CD
CM

样例 3

输入:

2
3888 3999

输出:

MMMDCCCLXXXVIII
MMMCMXCIX

样例说明

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.