結果

問題 No.211 素数サイコロと合成数サイコロ (1)
ユーザー tsunabittsunabit
提出日時 2018-05-13 02:39:14
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,310 bytes
コンパイル時間 4,263 ms
コンパイル使用メモリ 71,892 KB
実行使用メモリ 56,260 KB
最終ジャッジ日時 2023-09-10 18:40:50
合計ジャッジ時間 9,516 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,692 KB
testcase_01 AC 127 ms
55,720 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 125 ms
55,992 KB
testcase_07 AC 125 ms
53,920 KB
testcase_08 WA -
testcase_09 AC 128 ms
55,844 KB
testcase_10 AC 126 ms
55,532 KB
testcase_11 WA -
testcase_12 AC 127 ms
56,260 KB
testcase_13 AC 127 ms
55,696 KB
testcase_14 AC 127 ms
55,432 KB
testcase_15 AC 126 ms
55,776 KB
testcase_16 AC 126 ms
55,892 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 128 ms
55,396 KB
testcase_20 AC 127 ms
55,760 KB
testcase_21 AC 128 ms
55,420 KB
testcase_22 AC 125 ms
55,916 KB
testcase_23 AC 126 ms
53,944 KB
testcase_24 AC 126 ms
55,924 KB
testcase_25 AC 124 ms
55,752 KB
testcase_26 AC 125 ms
55,856 KB
testcase_27 AC 127 ms
56,000 KB
testcase_28 AC 125 ms
53,748 KB
testcase_29 AC 126 ms
55,976 KB
testcase_30 AC 126 ms
55,964 KB
testcase_31 AC 128 ms
55,776 KB
testcase_32 AC 127 ms
55,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

// ***問題文***
// 素数サイコロとはそれぞれの面に 2,3,5,7,11,13 の整数が書かれているサイコロである。
// 合成数サイコロとはそれぞれの面に 4,6,8,9,10,12 の整数が書かれているサイコロである。
// 素数サイコロと合成数サイコロを 1 つずつ振った時、出目の積が K となる確率を求めるプログラムを書いてください。
// 各面が出る確率はすべて 1/6 で、それぞれのサイコロについて出る面は独立です。
// ***入力***
// K
// 0≤K≤200:整数
// ***出力***
// 答えを出力してください。 絶対誤差で 10−12 までの誤差は許容されます。

public class No211 {
    public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int[] s = {2,3,5,7,11,13};
        int[] g = {4,6,8,9,10,12};
        int count = 0;
        for(int i = 0; i < s.length; i++) {
            for(int j = 0; j < g.length; j++) {
                if(s[i] * g[j] == k) {
                    count++;
                }
            }
        }
        System.out.println(((1 / 6) * (1/ 6)) * count);
    }
}
0