結果

問題 No.212 素数サイコロと合成数サイコロ (2)
ユーザー 学ぶマン
提出日時 2025-07-24 20:45:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 3,365 ms / 5,000 ms
コード長 493 bytes
コンパイル時間 644 ms
コンパイル使用メモリ 82,444 KB
実行使用メモリ 76,564 KB
最終ジャッジ日時 2025-07-24 20:46:05
合計ジャッジ時間 6,268 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import product, combinations, permutations, groupby, accumulate
P, C = map(int, input().split())
sosu = [2, 3, 5, 7, 11, 13]
gose = [4, 6, 8, 9, 10, 12]

total = 0
for pat1 in product([i for i in range(6)], repeat=P):
    # P個の 0-5 の数字
    a = 1
    for num in pat1:
        a *= sosu[num]
    for pat2 in product([i for i in range(6)], repeat=C):
        b = a
        for num in pat2:
            b *= gose[num]
        total += b

ans = total/6**(P + C)
print(ans)
0