結果

問題 No.405 ローマ数字の腕時計
ユーザー jimanojimano
提出日時 2018-01-25 19:34:31
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 901 bytes
コンパイル時間 2,946 ms
コンパイル使用メモリ 72,160 KB
実行使用メモリ 51,840 KB
最終ジャッジ日時 2023-08-27 05:51:35
合計ジャッジ時間 5,752 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 44 ms
49,220 KB
testcase_03 AC 44 ms
49,064 KB
testcase_04 AC 44 ms
49,308 KB
testcase_05 AC 43 ms
49,228 KB
testcase_06 AC 45 ms
49,216 KB
testcase_07 AC 43 ms
49,276 KB
testcase_08 AC 43 ms
49,284 KB
testcase_09 AC 44 ms
49,328 KB
testcase_10 WA -
testcase_11 AC 44 ms
49,068 KB
testcase_12 WA -
testcase_13 AC 44 ms
49,320 KB
testcase_14 AC 43 ms
47,240 KB
testcase_15 AC 44 ms
49,268 KB
testcase_16 AC 43 ms
49,224 KB
testcase_17 AC 44 ms
49,296 KB
testcase_18 AC 44 ms
49,224 KB
testcase_19 AC 43 ms
49,064 KB
testcase_20 AC 43 ms
49,428 KB
testcase_21 AC 43 ms
49,588 KB
testcase_22 AC 43 ms
49,288 KB
testcase_23 WA -
testcase_24 AC 43 ms
49,148 KB
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package me.yukicoder.lv1;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class No0405 {
	public static void main(String[] args) {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			String[] input = br.readLine().split(" ");
			String[] roman = { "I", "II", "III", "IIII", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII" };

			// いま何時?
			int hour = 1;
			for (int i = 0; i < roman.length; i++) {
				if (input[0].equals(roman[i])) {
					hour = i;
					break;
				}
			}

			// 12で割ったあまりだけ進むor戻る
			int T = Integer.parseInt(input[1]) % 12;
			int ans = hour + T;
			if (ans < 0) {
				ans = roman.length + T;
			} else if (ans >= roman.length) {
				ans = (ans % 12) - 1;
			}
			System.out.println(roman[ans]);

		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
0