結果

問題 No.405 ローマ数字の腕時計
ユーザー 37zigen37zigen
提出日時 2016-08-05 22:29:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 570 bytes
コンパイル時間 2,019 ms
コンパイル使用メモリ 72,376 KB
実行使用メモリ 56,208 KB
最終ジャッジ日時 2023-09-21 00:13:09
合計ジャッジ時間 6,697 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,540 KB
testcase_01 AC 122 ms
55,620 KB
testcase_02 AC 120 ms
56,056 KB
testcase_03 AC 120 ms
55,800 KB
testcase_04 AC 119 ms
56,028 KB
testcase_05 AC 119 ms
55,948 KB
testcase_06 AC 120 ms
56,060 KB
testcase_07 AC 122 ms
55,344 KB
testcase_08 AC 120 ms
55,496 KB
testcase_09 AC 119 ms
55,656 KB
testcase_10 AC 119 ms
55,900 KB
testcase_11 AC 119 ms
55,600 KB
testcase_12 AC 121 ms
55,456 KB
testcase_13 AC 118 ms
55,544 KB
testcase_14 AC 120 ms
55,620 KB
testcase_15 AC 121 ms
55,684 KB
testcase_16 AC 121 ms
55,884 KB
testcase_17 AC 121 ms
55,880 KB
testcase_18 AC 121 ms
55,992 KB
testcase_19 AC 120 ms
56,088 KB
testcase_20 AC 122 ms
55,860 KB
testcase_21 AC 120 ms
55,516 KB
testcase_22 AC 118 ms
55,908 KB
testcase_23 AC 119 ms
56,208 KB
testcase_24 AC 120 ms
56,144 KB
testcase_25 AC 120 ms
56,000 KB
testcase_26 AC 120 ms
56,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	public static void main(String[] args) {
		solver();
	}

	static void solver() {
		Scanner sc = new Scanner(System.in);
		String[] s = { "XII", "I", "II", "III", "IIII", "V", "VI", "VII", "VIII", "IX", "X", "XI" };
		String s1 = sc.next();
		int idx = -1;
		for (int i = 0; i < s.length; i++) {
			if (s1.equals(s[i])) {
				idx = i;
			}
		}
		if (idx == -1) {
			throw new AssertionError();
		}
		int cur = sc.nextInt();
		idx += cur;
		while (idx < 0) {
			idx += 12;
		}
		idx %= 12;
		System.out.println(s[idx]);
	}
}
0