結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
57,292 KB
testcase_01 AC 117 ms
55,508 KB
testcase_02 AC 117 ms
57,144 KB
testcase_03 AC 116 ms
56,988 KB
testcase_04 AC 119 ms
57,484 KB
testcase_05 AC 107 ms
56,236 KB
testcase_06 AC 115 ms
56,876 KB
testcase_07 AC 122 ms
57,516 KB
testcase_08 AC 120 ms
57,316 KB
testcase_09 AC 122 ms
57,648 KB
testcase_10 AC 127 ms
56,260 KB
testcase_11 AC 116 ms
57,552 KB
testcase_12 WA -
testcase_13 AC 106 ms
56,252 KB
testcase_14 AC 117 ms
57,520 KB
testcase_15 AC 115 ms
57,348 KB
testcase_16 AC 117 ms
57,252 KB
testcase_17 AC 116 ms
57,304 KB
testcase_18 AC 108 ms
56,236 KB
testcase_19 AC 107 ms
56,232 KB
testcase_20 AC 116 ms
57,344 KB
testcase_21 AC 107 ms
56,248 KB
testcase_22 AC 116 ms
57,400 KB
testcase_23 AC 115 ms
57,540 KB
testcase_24 AC 116 ms
57,320 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