結果

問題 No.405 ローマ数字の腕時計
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-10 22:04:17
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 1,947 ms
コンパイル使用メモリ 71,632 KB
実行使用メモリ 56,376 KB
最終ジャッジ日時 2023-09-21 00:32:15
合計ジャッジ時間 6,552 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
56,168 KB
testcase_01 AC 126 ms
55,864 KB
testcase_02 AC 125 ms
55,844 KB
testcase_03 AC 123 ms
56,376 KB
testcase_04 AC 123 ms
55,712 KB
testcase_05 AC 124 ms
55,800 KB
testcase_06 AC 124 ms
56,164 KB
testcase_07 AC 124 ms
56,068 KB
testcase_08 AC 126 ms
56,052 KB
testcase_09 AC 124 ms
55,528 KB
testcase_10 AC 123 ms
55,764 KB
testcase_11 AC 122 ms
55,968 KB
testcase_12 AC 125 ms
55,860 KB
testcase_13 AC 124 ms
54,360 KB
testcase_14 AC 123 ms
55,816 KB
testcase_15 AC 123 ms
55,964 KB
testcase_16 AC 122 ms
55,900 KB
testcase_17 AC 122 ms
55,900 KB
testcase_18 AC 122 ms
55,620 KB
testcase_19 AC 124 ms
55,872 KB
testcase_20 AC 122 ms
55,708 KB
testcase_21 AC 124 ms
55,860 KB
testcase_22 AC 126 ms
56,112 KB
testcase_23 AC 122 ms
55,496 KB
testcase_24 AC 125 ms
55,712 KB
testcase_25 AC 123 ms
56,076 KB
testcase_26 AC 121 ms
55,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		String[] ar = {"XII","I","II","III","IIII","V","VI","VII","VIII","IX","X","XI"};
		
		String s = sc.next();
		int n = sc.nextInt();
		int h = 0;
		for (int i=0; i<ar.length; i++) {
			if (s.equals(ar[i])) {h = i; break;}
		}
		
		//hからn時間後
		int ans = (h+n)%12;
		if (ans < 0) {
			ans = ans%12 + 12;
		}
		System.out.println(ar[ans]);
	}
}
0