問題一覧 > 通常問題

No.405 Roman Numeral Wristwatch

レベル : / AI推定難易度 : 115 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 598
作問者 : No / テスター : btk
お気に入りにしたユーザー ProblemId : 826 / 自分の提出
問題文最終更新日: 2026-06-25 04:33:57
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 145 (順位表) の他の問題:

Problem Statement

There is a wristwatch whose dial is marked with Roman numerals.
Now, the hour hand points to the position of the Roman numeral S1,
and the minute hand points to the position of "XII".
Where will the hour hand be after T hours?

Output the Roman numeral S2 at the position of the hour hand after T hours.

The Roman numerals marked on the dial are, in order starting from 1 o'clock,
"I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII".
Each Roman numeral is expressed by combining the uppercase letters "I","V","X".

Input

S1 T

S1 is a string of a Roman numeral (as listed in the problem statement), and T is an Arabic numeral.

$-1000 \le T \le 1000$

Output

Output S2. S2 is a string of a Roman numeral.

Print a newline at the end.

Sample

Sample 1
Input
XII 4
Output
IIII

It is 4 hours after 0 o'clock, so the hour hand points to "IIII".
Note that this Roman numeral for "4" is specific to clocks.

Sample 2
Input
VI 12
Output
VI

It is 12 hours after 6 o'clock, so the hour hand returns to its original position and points to "VI".

Sample 3
Input
I -26
Output
XI

It is -26 hours after 1 o'clock, that is, 26 hours before, so the hour hand points to "XI".

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。