結果

問題 No.405 ローマ数字の腕時計
ユーザー atkrymatkrym
提出日時 2016-10-18 12:07:32
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 954 bytes
コンパイル時間 2,031 ms
コンパイル使用メモリ 74,932 KB
実行使用メモリ 56,352 KB
最終ジャッジ日時 2023-09-21 00:22:14
合計ジャッジ時間 6,390 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
56,080 KB
testcase_01 AC 119 ms
55,524 KB
testcase_02 AC 119 ms
55,792 KB
testcase_03 AC 122 ms
56,204 KB
testcase_04 AC 118 ms
56,080 KB
testcase_05 AC 119 ms
56,332 KB
testcase_06 AC 118 ms
55,744 KB
testcase_07 AC 119 ms
56,352 KB
testcase_08 AC 119 ms
55,816 KB
testcase_09 AC 119 ms
56,188 KB
testcase_10 AC 119 ms
56,216 KB
testcase_11 AC 119 ms
55,784 KB
testcase_12 AC 120 ms
55,436 KB
testcase_13 AC 120 ms
55,840 KB
testcase_14 AC 122 ms
55,868 KB
testcase_15 AC 119 ms
55,848 KB
testcase_16 AC 117 ms
55,384 KB
testcase_17 AC 120 ms
56,048 KB
testcase_18 AC 121 ms
55,560 KB
testcase_19 AC 120 ms
55,840 KB
testcase_20 AC 118 ms
56,340 KB
testcase_21 AC 117 ms
56,120 KB
testcase_22 AC 122 ms
55,860 KB
testcase_23 AC 117 ms
56,096 KB
testcase_24 AC 122 ms
55,552 KB
testcase_25 AC 120 ms
55,812 KB
testcase_26 AC 125 ms
55,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    private static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) throws Exception {
        Map<String, Integer> map = new HashMap<>();
        map.put("I", 1);
        map.put("II", 2);
        map.put("III", 3);
        map.put("IIII", 4);
        map.put("V", 5);
        map.put("VI", 6);
        map.put("VII", 7);
        map.put("VIII", 8);
        map.put("IX", 9);
        map.put("X", 10);
        map.put("XI", 11);
        map.put("XII", 12);
        
        String s = sc.next();
        
        int t = map.get(s);
        
        int diff = sc.nextInt() % 12;
        diff = diff < 0 ? diff + 12 : diff;
        t += diff;
        if (t > 12) t -= 12;
        
        for (Map.Entry<String, Integer> entry : map.entrySet()) {
            if (entry.getValue() == t) {
                System.out.println(entry.getKey());
            }
        }
        
    }
}
0