結果

問題 No.212 素数サイコロと合成数サイコロ (2)
ユーザー e-mone-mon
提出日時 2015-05-22 22:42:37
言語 PyPy3
(7.3.8)
結果
AC  
実行時間 1,653 ms / 5,000 ms
コード長 385 bytes
コンパイル時間 260 ms
使用メモリ 85,284 KB
最終ジャッジ日時 2023-02-08 18:42:32
合計ジャッジ時間 4,405 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 74 ms
75,828 KB
testcase_01 AC 81 ms
80,476 KB
testcase_02 AC 72 ms
75,728 KB
testcase_03 AC 79 ms
80,504 KB
testcase_04 AC 147 ms
81,888 KB
testcase_05 AC 1,653 ms
85,284 KB
testcase_06 AC 386 ms
83,124 KB
testcase_07 AC 380 ms
82,016 KB
testcase_08 AC 82 ms
80,504 KB
testcase_09 AC 80 ms
80,644 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import itertools

pS = [2,3,5,7,11,13]
cS = [4,6,8,9,10,12]

P,C = map(int,input().split())

def dfs(P,C,k):
    ret = 0
    if P != 0:
        for p in pS:
            ret += dfs(P-1,C,k*p)
    elif C != 0:
        for c in cS:
            ret += dfs(0,C-1,k*c)
    else:
        return  k
    return ret

print(dfs(P,C,1) / ( 6**(P+C)))
0