結果

問題 No.405 ローマ数字の腕時計
ユーザー 37zigen
提出日時 2016-08-05 22:29:41
言語 Java
(openjdk 23)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 570 bytes
コンパイル時間 2,113 ms
コンパイル使用メモリ 74,680 KB
実行使用メモリ 41,836 KB
最終ジャッジ日時 2024-07-06 18:58:42
合計ジャッジ時間 6,823 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

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