結果

問題 No.211 素数サイコロと合成数サイコロ (1)
ユーザー Hiroaki KonoHiroaki Kono
提出日時 2017-10-31 21:13:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 1,000 ms
コード長 843 bytes
コンパイル時間 3,381 ms
コンパイル使用メモリ 78,048 KB
実行使用メモリ 56,380 KB
最終ジャッジ日時 2023-09-08 06:27:58
合計ジャッジ時間 8,826 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,568 KB
testcase_01 AC 124 ms
55,768 KB
testcase_02 AC 126 ms
55,908 KB
testcase_03 AC 122 ms
56,040 KB
testcase_04 AC 123 ms
56,092 KB
testcase_05 AC 126 ms
55,808 KB
testcase_06 AC 127 ms
56,016 KB
testcase_07 AC 127 ms
55,920 KB
testcase_08 AC 125 ms
55,864 KB
testcase_09 AC 124 ms
56,260 KB
testcase_10 AC 124 ms
55,936 KB
testcase_11 AC 127 ms
55,864 KB
testcase_12 AC 127 ms
55,696 KB
testcase_13 AC 126 ms
54,292 KB
testcase_14 AC 124 ms
55,712 KB
testcase_15 AC 127 ms
55,832 KB
testcase_16 AC 124 ms
55,688 KB
testcase_17 AC 126 ms
55,820 KB
testcase_18 AC 124 ms
55,808 KB
testcase_19 AC 125 ms
55,404 KB
testcase_20 AC 125 ms
55,480 KB
testcase_21 AC 124 ms
55,644 KB
testcase_22 AC 125 ms
55,692 KB
testcase_23 AC 122 ms
55,864 KB
testcase_24 AC 124 ms
55,760 KB
testcase_25 AC 123 ms
55,740 KB
testcase_26 AC 124 ms
55,808 KB
testcase_27 AC 123 ms
56,096 KB
testcase_28 AC 123 ms
55,440 KB
testcase_29 AC 124 ms
56,380 KB
testcase_30 AC 128 ms
56,268 KB
testcase_31 AC 124 ms
56,120 KB
testcase_32 AC 127 ms
55,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class No211 {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int num = s.nextInt();
        int[] primes = {2, 3, 5, 7, 11, 13};
        int[] composites = {4, 6, 8, 9, 10, 12};
        Map<Integer, Double> map = new HashMap<>();
        for (int prime : primes) {
            for (int composite : composites) {
                int tmp = prime * composite;
                if (map.containsKey(tmp)) {
                    map.put(tmp, map.get(tmp) + 1);
                } else {
                    map.put(tmp, 1d);
                }
            }
        }
        double prop = 0L;
        if (map.containsKey(num)) {
            prop = map.get(num) / 36;
        }
        System.out.println(prop);
    }
}
0