結果

問題 No.405 ローマ数字の腕時計
ユーザー uafr_cs
提出日時 2016-08-05 22:25:30
言語 Java8
(openjdk 1.8.0.191)
結果
AC  
実行時間 106 ms
コード長 870 Byte
コンパイル時間 1,358 ms
使用メモリ 32,736 KB
最終ジャッジ日時 2019-04-28 19:24:59

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
99_system_test1.txt AC 102 ms
31,968 KB
99_system_test2.txt AC 102 ms
31,892 KB
input01.txt AC 102 ms
30,164 KB
input02.txt AC 100 ms
32,728 KB
input03.txt AC 100 ms
31,888 KB
input04.txt AC 102 ms
31,892 KB
input05.txt AC 102 ms
31,888 KB
input06.txt AC 99 ms
31,888 KB
input07.txt AC 102 ms
30,816 KB
input08.txt AC 103 ms
31,896 KB
input09.txt AC 101 ms
32,736 KB
input10.txt AC 101 ms
30,120 KB
input11.txt AC 106 ms
30,848 KB
input12.txt AC 106 ms
31,888 KB
input13.txt AC 106 ms
30,124 KB
input14.txt AC 103 ms
32,728 KB
input15.txt AC 105 ms
31,888 KB
input16.txt AC 105 ms
31,884 KB
input17.txt AC 104 ms
31,884 KB
input18.txt AC 105 ms
30,824 KB
input19.txt AC 103 ms
32,224 KB
input20.txt AC 104 ms
31,888 KB
input21.txt AC 105 ms
32,480 KB
input22.txt AC 104 ms
32,720 KB
system_test1.txt AC 104 ms
31,892 KB
system_test2.txt AC 104 ms
32,160 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