結果

問題 No.211 素数サイコロと合成数サイコロ (1)
ユーザー dazydazy
提出日時 2017-02-23 19:48:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 1,000 ms
コード長 751 bytes
コンパイル時間 3,856 ms
コンパイル使用メモリ 73,244 KB
実行使用メモリ 57,816 KB
最終ジャッジ日時 2023-09-08 06:09:30
合計ジャッジ時間 8,534 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,724 KB
testcase_01 AC 119 ms
55,676 KB
testcase_02 AC 116 ms
55,680 KB
testcase_03 AC 124 ms
55,992 KB
testcase_04 AC 120 ms
55,740 KB
testcase_05 AC 118 ms
55,772 KB
testcase_06 AC 120 ms
55,872 KB
testcase_07 AC 119 ms
55,740 KB
testcase_08 AC 120 ms
55,664 KB
testcase_09 AC 121 ms
57,816 KB
testcase_10 AC 121 ms
55,696 KB
testcase_11 AC 119 ms
55,728 KB
testcase_12 AC 118 ms
55,740 KB
testcase_13 AC 122 ms
55,840 KB
testcase_14 AC 119 ms
55,672 KB
testcase_15 AC 120 ms
55,736 KB
testcase_16 AC 120 ms
55,880 KB
testcase_17 AC 121 ms
55,968 KB
testcase_18 AC 120 ms
56,020 KB
testcase_19 AC 119 ms
55,992 KB
testcase_20 AC 121 ms
55,768 KB
testcase_21 AC 122 ms
55,880 KB
testcase_22 AC 123 ms
55,776 KB
testcase_23 AC 120 ms
55,756 KB
testcase_24 AC 119 ms
55,876 KB
testcase_25 AC 118 ms
56,076 KB
testcase_26 AC 116 ms
55,936 KB
testcase_27 AC 117 ms
55,872 KB
testcase_28 AC 119 ms
55,716 KB
testcase_29 AC 119 ms
55,732 KB
testcase_30 AC 119 ms
55,696 KB
testcase_31 AC 121 ms
55,648 KB
testcase_32 AC 120 ms
55,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Run {
    public static void main (String arg[]) {
        Scanner scan = new Scanner(System.in);
        double ans = 0.0;
        int [] array1 = {2, 3, 5, 7, 11, 13};
        int [] array2 = {4, 6, 8, 9, 10, 12};
        int x;
        HashMap<Integer, Integer> M = new HashMap<>();
        for (int i = 0; i < array1.length; i++) {
            for (int j = 0; j < array2.length; j++) {
                x = array1[i] * array2[j];
                if (!M.containsKey(x)) M.put(x, 1);
                else M.put(x, M.get(x) + 1);
            }
        }
        int K = scan.nextInt();
        if (M.containsKey(K)) ans = ((double) M.get(K)) / (array1.length * array2.length);
        System.out.println(ans);
    }
}
0