#K41357. Roman Numeral Converter

    ID: 26847 Type: Default 1000ms 256MiB

Roman Numeral Converter

Roman Numeral Converter

In this problem, you are required to convert a given non-negative integer into its corresponding Roman numeral representation. The integer will be in the range of (1 \leq n \leq 3999). If the given integer is out of this range, the output should be an empty string. The Roman numeral system uses the following symbols:

  • I for 1
  • V for 5
  • X for 10
  • L for 50
  • C for 100
  • D for 500
  • M for 1000

Additionally, subtractive notation is used for numbers like 4 (IV) and 9 (IX). Your task is to implement an efficient conversion algorithm that reads an integer from standard input and prints its Roman numeral representation to standard output.

inputFormat

The input consists of a single integer (n), provided via standard input.

outputFormat

Output the Roman numeral representation of the integer (n) on standard output. If (n) is out of the valid range (1 to 3999), output an empty string.## sample

3
III