結果

問題 No.405 ローマ数字の腕時計
ユーザー uafr_cs
提出日時 2016-08-05 22:25:30
言語 Java8
(openjdk 1.8.0.181)
結果
AC  
実行時間 136 ms
コード長 870 Byte
コンパイル時間 1,626 ms
使用メモリ 21,072 KB
最終ジャッジ日時 2018-07-19 01:29:36

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
99_system_test1.txt AC 123 ms
21,060 KB
99_system_test2.txt AC 122 ms
21,064 KB
input01.txt AC 122 ms
20,836 KB
input02.txt AC 120 ms
20,840 KB
input03.txt AC 120 ms
20,836 KB
input04.txt AC 120 ms
20,840 KB
input05.txt AC 136 ms
21,032 KB
input06.txt AC 125 ms
20,840 KB
input07.txt AC 122 ms
21,056 KB
input08.txt AC 117 ms
20,836 KB
input09.txt AC 118 ms
20,864 KB
input10.txt AC 120 ms
21,060 KB
input11.txt AC 121 ms
20,840 KB
input12.txt AC 116 ms
21,060 KB
input13.txt AC 121 ms
21,056 KB
input14.txt AC 128 ms
20,836 KB
input15.txt AC 133 ms
20,832 KB
input16.txt AC 125 ms
21,072 KB
input17.txt AC 120 ms
21,060 KB
input18.txt AC 128 ms
21,064 KB
input19.txt AC 135 ms
20,868 KB
input20.txt AC 134 ms
21,040 KB
input21.txt AC 122 ms
20,840 KB
input22.txt AC 123 ms
21,056 KB
system_test1.txt AC 119 ms
20,836 KB
system_test2.txt AC 125 ms
21,060 KB
テストケース一括ダウンロード

ソースコード

diff #
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static int toInt(String str){
		final String[] arr = {"I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"};
		
		for(int i = 0; i < 12; i++){
			if(str.equals(arr[i])){
				return i;
			}
		}
		
		return 0;
	}
	
	public static String toStr(final int i){
		return new String[]{"I","II","III","IIII","V","VI","VII","VIII","IX","X","XI","XII"}[i];
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		final int S = toInt(sc.next());
		final int T = sc.nextInt();
		
		int ans_int = S;
		while(ans_int < 0){ ans_int += 12; }
		ans_int += 12;
		ans_int += T;
		while(ans_int < 0){ ans_int += 12; }
		ans_int %= 12;
		
		System.out.println(toStr(ans_int));
		
		
	}

}
0