結果

問題 No.405 ローマ数字の腕時計
ユーザー HAGI_TARO
提出日時 2021-10-12 10:16:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 550 bytes
コンパイル時間 198 ms
コンパイル使用メモリ 82,592 KB
実行使用メモリ 54,352 KB
最終ジャッジ日時 2024-07-06 19:34:10
合計ジャッジ時間 1,951 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

S,t = input().split()
num = 0
ans = ""
if S == "IX":
    num = 9
else:
    for i in range(len(S)):
        if S[i] == "X":
            num += 10
        elif S[i] == "V":
            num += 5
        else:
            num += 1
num += int(t) % 12
if num == 9 or num == 21:
    ans = "IX"
else:
    if num >= 13:
        num -= 12
    while num > 0:
        if num >= 10:
            ans += "X"
            num -= 10
        elif num >= 5:
            ans += "V"
            num -= 5
        else:
            ans += "I"
            num -= 1
print(ans)
0