結果

問題 No.405 ローマ数字の腕時計
ユーザー kenji_shioyakenji_shioya
提出日時 2016-10-23 01:20:37
言語 Java21
(openjdk 21)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 1,122 bytes
コンパイル時間 3,717 ms
コンパイル使用メモリ 74,788 KB
実行使用メモリ 57,844 KB
最終ジャッジ日時 2023-09-21 00:22:37
合計ジャッジ時間 7,537 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
56,172 KB
testcase_01 AC 120 ms
56,048 KB
testcase_02 AC 123 ms
56,112 KB
testcase_03 AC 122 ms
55,980 KB
testcase_04 AC 122 ms
55,972 KB
testcase_05 AC 120 ms
55,884 KB
testcase_06 AC 121 ms
55,924 KB
testcase_07 AC 119 ms
55,560 KB
testcase_08 AC 120 ms
55,672 KB
testcase_09 AC 120 ms
55,728 KB
testcase_10 AC 120 ms
55,440 KB
testcase_11 AC 122 ms
56,052 KB
testcase_12 AC 120 ms
55,724 KB
testcase_13 AC 118 ms
55,824 KB
testcase_14 AC 122 ms
55,956 KB
testcase_15 AC 120 ms
56,296 KB
testcase_16 AC 119 ms
55,784 KB
testcase_17 AC 120 ms
55,716 KB
testcase_18 AC 122 ms
55,832 KB
testcase_19 AC 121 ms
55,836 KB
testcase_20 AC 121 ms
57,844 KB
testcase_21 AC 121 ms
56,204 KB
testcase_22 AC 120 ms
56,108 KB
testcase_23 AC 119 ms
55,992 KB
testcase_24 AC 118 ms
55,976 KB
testcase_25 AC 118 ms
56,016 KB
testcase_26 AC 119 ms
55,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Exercise160 {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int time = toNum(sc.next());
    int hour = sc.nextInt();
    int num = (time + hour) % 12;
    if(num < 0){
      num = 12 + num;
    }
    System.out.println(toStr(num));
  }
  public static int toNum(String str){
    HashMap<String, Integer> map = new HashMap<String, Integer>();
    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", 0);
    return map.get(str);
  }
  public static String toStr(int num){
    HashMap<Integer, String> map = new HashMap<Integer, String>();
    map.put(1, "I");
    map.put(2, "II");
    map.put(3, "III");
    map.put(4, "IIII");
    map.put(5, "V");
    map.put(6, "VI");
    map.put(7, "VII");
    map.put(8, "VIII");
    map.put(9, "IX");
    map.put(10, "X");
    map.put(11, "XI");
    map.put(0, "XII");
    return map.get(num);
  }
}
0