P1465 [USACO2.2] Preface Numbering

Description

Given $n$, count how many times each character appears in the Roman numeral representations of $1 \sim n$. For example, when $n = 5$, the representations are I, II, III, IV, V. There are $7$ occurrences of I and $2$ occurrences of V.

Input Format

A single integer $n$.

Output Format

Each line contains a character and an integer $k$, indicating that this character appears $k$ times. Characters must be printed in the increasing order of the Roman numeral table.

Explanation/Hint

Constraints For $100\%$ of the testdata, $1 \le n \le 3500$. Translated from NOCOW. USACO 2.2. Translated by ChatGPT 5