結果

問題 No.211 素数サイコロと合成数サイコロ (1)
ユーザー samplelpmassamplelpmas
提出日時 2016-11-27 14:40:11
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 729 bytes
コンパイル時間 2,151 ms
コンパイル使用メモリ 73,644 KB
実行使用メモリ 41,512 KB
最終ジャッジ日時 2024-05-05 14:12:34
合計ジャッジ時間 8,073 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
41,072 KB
testcase_01 AC 129 ms
41,344 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 128 ms
41,044 KB
testcase_07 AC 132 ms
41,232 KB
testcase_08 WA -
testcase_09 AC 129 ms
41,300 KB
testcase_10 AC 130 ms
41,000 KB
testcase_11 WA -
testcase_12 AC 131 ms
41,328 KB
testcase_13 AC 132 ms
41,244 KB
testcase_14 AC 131 ms
41,344 KB
testcase_15 AC 117 ms
40,220 KB
testcase_16 AC 132 ms
41,456 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 136 ms
41,128 KB
testcase_20 AC 135 ms
41,408 KB
testcase_21 AC 134 ms
41,088 KB
testcase_22 AC 132 ms
41,148 KB
testcase_23 AC 133 ms
40,928 KB
testcase_24 AC 132 ms
41,276 KB
testcase_25 AC 132 ms
41,260 KB
testcase_26 AC 129 ms
41,208 KB
testcase_27 AC 130 ms
41,380 KB
testcase_28 AC 131 ms
40,920 KB
testcase_29 AC 117 ms
40,136 KB
testcase_30 AC 129 ms
41,172 KB
testcase_31 AC 132 ms
41,280 KB
testcase_32 AC 130 ms
41,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int[] PRIME_NUMBERS_DICE = {2, 3, 5, 7, 11, 13};
        int[] COMPOSITE_NUMBERS_DICE = {4, 6, 8, 9, 10, 12};

        int K = sc.nextInt();

        int happeningCount = 0;

        for (int i = 0; i < 6; i++) {

            for (int j = 0; j < 6; j++) {

                if ((PRIME_NUMBERS_DICE[i] * COMPOSITE_NUMBERS_DICE[j]) == K) {
                    happeningCount++;
                }

            }

        }

        double probabilityK = happeningCount / (PRIME_NUMBERS_DICE.length * COMPOSITE_NUMBERS_DICE.length);

        System.out.println(probabilityK);

    }

}
0