結果

問題 No.405 ローマ数字の腕時計
ユーザー fukuseifukusei
提出日時 2017-05-27 15:04:47
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 722 bytes
コンパイル時間 2,086 ms
コンパイル使用メモリ 74,644 KB
実行使用メモリ 57,884 KB
最終ジャッジ日時 2023-10-21 13:20:25
合計ジャッジ時間 6,199 ms
ジャッジサーバーID
(参考情報)
judge9 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
56,340 KB
testcase_01 AC 105 ms
56,204 KB
testcase_02 AC 108 ms
56,192 KB
testcase_03 AC 119 ms
57,224 KB
testcase_04 AC 116 ms
57,364 KB
testcase_05 AC 109 ms
56,248 KB
testcase_06 AC 103 ms
56,208 KB
testcase_07 AC 116 ms
57,364 KB
testcase_08 AC 114 ms
57,384 KB
testcase_09 WA -
testcase_10 AC 104 ms
55,988 KB
testcase_11 AC 114 ms
57,384 KB
testcase_12 WA -
testcase_13 AC 130 ms
57,404 KB
testcase_14 AC 116 ms
57,396 KB
testcase_15 AC 117 ms
57,216 KB
testcase_16 AC 109 ms
56,244 KB
testcase_17 WA -
testcase_18 AC 115 ms
56,204 KB
testcase_19 AC 107 ms
56,256 KB
testcase_20 AC 122 ms
57,468 KB
testcase_21 AC 117 ms
57,136 KB
testcase_22 AC 134 ms
56,200 KB
testcase_23 AC 119 ms
57,420 KB
testcase_24 AC 118 ms
57,432 KB
testcase_25 WA -
testcase_26 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class test{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		String S1 = sc.next();
		int def = 0;
		int sum = 0;
		int T = sc.nextInt();
		
		String roma[] = {"I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"};
		
		for(int i=0; i<roma.length; i++){
			if(S1.equals(roma[i])){
				def = i+1;
			}
		}
		
		while(def >= 12){
			def -= 12;
		}
		while(def <= -12){
			def += 12;
		}
		while(T >= 12){
			T -= 12;
		}
		while(T <= -12){
			T += 12;
		}
		
		sum = def + T;
		
		while(sum > 12){
			sum -= 12;
		}
		while(sum < 0){
			sum += 12;
		}

		for(int i=0; i<roma.length; i++){
			if(sum == i+1){
				System.out.println(roma[i]);
			}
		}
		
	}
}
0