結果

問題 No.405 ローマ数字の腕時計
ユーザー TwinkleStar74TwinkleStar74
提出日時 2017-10-18 00:00:48
言語 Java21
(openjdk 21)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 821 bytes
コンパイル時間 3,075 ms
コンパイル使用メモリ 72,164 KB
実行使用メモリ 49,788 KB
最終ジャッジ日時 2023-09-21 00:29:52
合計ジャッジ時間 5,393 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
49,584 KB
testcase_01 AC 42 ms
49,248 KB
testcase_02 AC 42 ms
49,412 KB
testcase_03 AC 42 ms
49,296 KB
testcase_04 AC 42 ms
49,436 KB
testcase_05 AC 43 ms
49,444 KB
testcase_06 AC 42 ms
49,476 KB
testcase_07 AC 42 ms
49,364 KB
testcase_08 AC 42 ms
49,340 KB
testcase_09 AC 42 ms
49,532 KB
testcase_10 AC 42 ms
49,788 KB
testcase_11 AC 41 ms
49,360 KB
testcase_12 AC 41 ms
47,580 KB
testcase_13 AC 41 ms
49,280 KB
testcase_14 AC 41 ms
49,564 KB
testcase_15 AC 40 ms
47,772 KB
testcase_16 AC 42 ms
49,372 KB
testcase_17 AC 42 ms
49,368 KB
testcase_18 AC 42 ms
49,368 KB
testcase_19 AC 43 ms
47,476 KB
testcase_20 AC 42 ms
49,288 KB
testcase_21 AC 44 ms
49,488 KB
testcase_22 AC 42 ms
49,332 KB
testcase_23 AC 42 ms
49,244 KB
testcase_24 AC 41 ms
49,236 KB
testcase_25 AC 44 ms
49,336 KB
testcase_26 AC 44 ms
49,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class No405 {

	public static void main(String[] args) throws IOException{
		String[] romeNum = {"XII","I","II","III","IIII","V","VI","VII","VIII","IX","X","XI"};
		String[] temp = new BufferedReader(new InputStreamReader(System.in)).readLine().split(" ");
		int nowTime = getTime(romeNum, temp[0]);
		System.out.println(romeNum[getAnswerTime(nowTime,temp[1])]);
	}
	
	public static int getTime(String[] a, String b){
		int time = 0;
		for(int i=0; i< a.length; i++){
			if(a[i].equals(b)) time = i;
		}
		return time;
		
	}
	
	public static int getAnswerTime(int a,String b){
		int pastTime = Integer.parseInt(b);
		int answerTime = (a + pastTime) % 12;
		if(answerTime < 0) answerTime += 12;
		return answerTime;
	}
}
0