結果

問題 No.405 ローマ数字の腕時計
ユーザー uafr_cs
提出日時 2016-08-05 22:25:30
言語 Java8
(openjdk 1.8.0.191)
結果
AC  
実行時間 137 ms
コード長 870 Byte
コンパイル時間 1,617 ms
使用メモリ 21,404 KB
最終ジャッジ日時 2019-01-12 13:27:49

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
99_system_test1.txt AC 124 ms
21,168 KB
99_system_test2.txt AC 126 ms
21,196 KB
input01.txt AC 126 ms
21,192 KB
input02.txt AC 124 ms
21,196 KB
input03.txt AC 123 ms
21,196 KB
input04.txt AC 137 ms
21,380 KB
input05.txt AC 123 ms
21,196 KB
input06.txt AC 125 ms
21,404 KB
input07.txt AC 123 ms
21,164 KB
input08.txt AC 125 ms
21,200 KB
input09.txt AC 129 ms
21,196 KB
input10.txt AC 129 ms
21,196 KB
input11.txt AC 125 ms
21,200 KB
input12.txt AC 125 ms
21,164 KB
input13.txt AC 125 ms
21,136 KB
input14.txt AC 127 ms
21,200 KB
input15.txt AC 125 ms
21,160 KB
input16.txt AC 127 ms
21,200 KB
input17.txt AC 129 ms
21,200 KB
input18.txt AC 125 ms
21,200 KB
input19.txt AC 125 ms
21,168 KB
input20.txt AC 126 ms
21,196 KB
input21.txt AC 126 ms
21,196 KB
input22.txt AC 128 ms
21,208 KB
system_test1.txt AC 130 ms
21,204 KB
system_test2.txt AC 130 ms
21,180 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