#P1465. [USACO2.2] 序言页码 Preface Numbering

[USACO2.2] 序言页码 Preface Numbering

Description

Given nn, count how many times each character appears in the Roman numeral representations of 1n1 \sim n.

For example, when n=5n = 5, the representations are I, II, III, IV, V. There are 77 occurrences of I and 22 occurrences of V.

Input Format

A single integer nn.

Output Format

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

5

I 7
V 2

Hint

Constraints
For 100%100\% of the testdata, 1n35001 \le n \le 3500.

Translated from NOCOW.

USACO 2.2.

Translated by ChatGPT 5