結果

問題 No.405 ローマ数字の腕時計
ユーザー HEGO55HEGO55
提出日時 2017-05-27 15:25:22
言語 Java21
(openjdk 21)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 751 bytes
コンパイル時間 1,819 ms
コンパイル使用メモリ 73,392 KB
実行使用メモリ 58,272 KB
最終ジャッジ日時 2023-09-21 00:26:45
合計ジャッジ時間 6,252 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
56,072 KB
testcase_01 AC 120 ms
56,456 KB
testcase_02 AC 121 ms
55,640 KB
testcase_03 AC 118 ms
55,820 KB
testcase_04 AC 120 ms
56,116 KB
testcase_05 AC 120 ms
55,840 KB
testcase_06 AC 120 ms
56,012 KB
testcase_07 AC 120 ms
55,784 KB
testcase_08 AC 119 ms
56,072 KB
testcase_09 AC 120 ms
56,136 KB
testcase_10 AC 120 ms
55,436 KB
testcase_11 AC 118 ms
55,984 KB
testcase_12 AC 120 ms
55,916 KB
testcase_13 AC 119 ms
55,744 KB
testcase_14 AC 120 ms
56,636 KB
testcase_15 AC 121 ms
55,780 KB
testcase_16 AC 120 ms
58,272 KB
testcase_17 AC 120 ms
55,868 KB
testcase_18 AC 120 ms
55,804 KB
testcase_19 AC 121 ms
56,004 KB
testcase_20 AC 121 ms
55,644 KB
testcase_21 AC 121 ms
55,920 KB
testcase_22 AC 120 ms
55,692 KB
testcase_23 AC 119 ms
55,420 KB
testcase_24 AC 121 ms
56,252 KB
testcase_25 AC 122 ms
55,804 KB
testcase_26 AC 121 ms
55,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class No405{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int t = 0;
		
		String[] S1List = {"I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"};
		int[] TList     = {1,2,3,4,5,6,7,8,9,10,11,12};
			
		String S1 = sc.next();
		int T = sc.nextInt();
		
		for(int i=0; i<S1List.length; i++){
			if(S1List[i].equals(S1)){
				t = TList[i];
			}
		}
		
		int add = T + t;
		if(add>0){
			if(add<=12){
				System.out.println(S1List[add-1]);
			}else{
				while(add>12){
				   add -= 12;
				}
				System.out.println(S1List[add-1]);
			}
		}else if(add<0){
			while(add<=0){
			add += 12;
		}
			System.out.println(S1List[add-1]);
		}else{
			System.out.println(S1List[11]);
		}
	}
}
		
0