結果

問題 No.405 ローマ数字の腕時計
ユーザー fukuseifukusei
提出日時 2017-05-27 15:10:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 720 bytes
コンパイル時間 1,863 ms
コンパイル使用メモリ 72,056 KB
実行使用メモリ 56,492 KB
最終ジャッジ日時 2023-09-21 00:26:55
合計ジャッジ時間 6,302 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
56,248 KB
testcase_01 AC 120 ms
56,368 KB
testcase_02 AC 120 ms
55,912 KB
testcase_03 AC 119 ms
55,836 KB
testcase_04 AC 120 ms
55,640 KB
testcase_05 AC 120 ms
55,932 KB
testcase_06 AC 121 ms
56,356 KB
testcase_07 AC 121 ms
55,744 KB
testcase_08 AC 122 ms
56,160 KB
testcase_09 AC 116 ms
55,872 KB
testcase_10 AC 121 ms
56,184 KB
testcase_11 AC 120 ms
55,820 KB
testcase_12 AC 122 ms
56,160 KB
testcase_13 AC 121 ms
55,672 KB
testcase_14 AC 122 ms
56,108 KB
testcase_15 AC 122 ms
56,460 KB
testcase_16 AC 121 ms
56,476 KB
testcase_17 AC 120 ms
56,236 KB
testcase_18 AC 122 ms
56,492 KB
testcase_19 AC 121 ms
56,152 KB
testcase_20 AC 122 ms
55,844 KB
testcase_21 AC 122 ms
55,848 KB
testcase_22 AC 123 ms
56,004 KB
testcase_23 AC 126 ms
56,260 KB
testcase_24 AC 122 ms
56,476 KB
testcase_25 AC 120 ms
56,200 KB
testcase_26 AC 121 ms
56,360 KB
権限があれば一括ダウンロードができます

ソースコード

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