結果

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

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
99_system_test1.txt AC 104 ms
21,768 KB
99_system_test2.txt AC 106 ms
21,576 KB
input01.txt AC 110 ms
21,556 KB
input02.txt AC 111 ms
21,552 KB
input03.txt AC 109 ms
21,544 KB
input04.txt AC 110 ms
21,580 KB
input05.txt AC 110 ms
21,584 KB
input06.txt AC 112 ms
21,576 KB
input07.txt AC 110 ms
21,552 KB
input08.txt AC 111 ms
21,580 KB
input09.txt AC 109 ms
21,580 KB
input10.txt AC 109 ms
21,576 KB
input11.txt AC 109 ms
21,584 KB
input12.txt AC 117 ms
22,740 KB
input13.txt AC 108 ms
21,788 KB
input14.txt AC 109 ms
21,588 KB
input15.txt AC 108 ms
21,788 KB
input16.txt AC 112 ms
21,556 KB
input17.txt AC 110 ms
21,556 KB
input18.txt AC 111 ms
21,576 KB
input19.txt AC 108 ms
21,552 KB
input20.txt AC 108 ms
21,764 KB
input21.txt AC 109 ms
21,588 KB
input22.txt AC 107 ms
21,764 KB
system_test1.txt AC 107 ms
21,560 KB
system_test2.txt AC 107 ms
21,768 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