結果

問題 No.405 ローマ数字の腕時計
ユーザー jimanojimano
提出日時 2018-01-25 20:01:51
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 843 bytes
コンパイル時間 3,039 ms
コンパイル使用メモリ 71,884 KB
実行使用メモリ 49,944 KB
最終ジャッジ日時 2023-08-27 05:51:59
合計ジャッジ時間 5,281 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,364 KB
testcase_01 AC 43 ms
49,636 KB
testcase_02 AC 43 ms
49,316 KB
testcase_03 AC 43 ms
49,276 KB
testcase_04 AC 43 ms
49,324 KB
testcase_05 AC 43 ms
49,500 KB
testcase_06 RE -
testcase_07 AC 42 ms
49,300 KB
testcase_08 AC 42 ms
49,400 KB
testcase_09 RE -
testcase_10 AC 42 ms
49,540 KB
testcase_11 AC 43 ms
49,416 KB
testcase_12 RE -
testcase_13 AC 42 ms
49,532 KB
testcase_14 AC 44 ms
49,328 KB
testcase_15 AC 43 ms
49,452 KB
testcase_16 AC 43 ms
47,412 KB
testcase_17 RE -
testcase_18 AC 42 ms
49,528 KB
testcase_19 AC 42 ms
49,412 KB
testcase_20 AC 43 ms
49,384 KB
testcase_21 AC 42 ms
49,332 KB
testcase_22 AC 43 ms
49,336 KB
testcase_23 AC 42 ms
49,208 KB
testcase_24 AC 43 ms
49,332 KB
testcase_25 RE -
testcase_26 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

package me.yukicoder.lv1;

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

public class No0405 {
	public static void main(String[] args) {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			String[] input = br.readLine().split(" ");
			String[] roman = { "I", "II", "III", "IIII", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII" };

			// いま何時?
			int hour = 1;
			for (int i = 0; i < roman.length; i++) {
				if (input[0].equals(roman[i])) {
					hour = i + 1;
					break;
				}
			}

			// 現在時刻+T時を12で割ったあまりだけ進むor戻る
			int ans = (hour + Integer.parseInt(input[1])) % 12;
			ans = (ans >= 0 ? ans : ans + 12);
			System.out.println(roman[ans - 1]);

		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
0