#P1465. Roman Numerals Character Counting

    ID: 14751 Type: Default 1000ms 256MiB

Roman Numerals Character Counting

Roman Numerals Character Counting

Given an integer (n), for each integer from (1) to (n) convert it to its Roman numeral representation and count the occurrences of each Roman numeral character. Use the standard Roman numeral rules: [ {1000:M,;900:CM,;500:D,;400:CD,;100:C,;90:XC,;50:L,;40:XL,;10:X,;9:IX,;5:V,;4:IV,;1:I}] ] Output each Roman numeral character and its total count (if the count is nonzero) in the following order: I, V, X, L, C, D, M.

inputFormat

The input consists of a single integer (n) ((1 \le n \le 3500)) on one line.

outputFormat

For each Roman numeral character that appears at least once in any representation from 1 to (n), print a line containing the character and its total count separated by a space. The output should list the characters in the order: I, V, X, L, C, D, M.

sample

5
I 7

V 2

</p>