結果

問題 No.144 エラトステネスのざる
ユーザー Yuki IwatakeYuki Iwatake
提出日時 2020-11-29 20:52:08
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 236 bytes
コンパイル時間 446 ms
コンパイル使用メモリ 87,300 KB
実行使用メモリ 90,052 KB
最終ジャッジ日時 2023-10-11 02:37:00
合計ジャッジ時間 4,768 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
78,476 KB
testcase_01 AC 79 ms
71,444 KB
testcase_02 AC 75 ms
71,380 KB
testcase_03 AC 74 ms
71,472 KB
testcase_04 AC 73 ms
71,276 KB
testcase_05 AC 74 ms
71,156 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N,p = input().split()
N = int(N)
p = float(p)
A0 = list(range(2,N+1))

def E(A):
    if len(A)==0:
        return 0
    a = A[0]
    A_s = [i for i in A if i%a != 0]
    A_f = A[1:]
    return p*(E(A_s)+1)+(1-p)*(E(A_f)+1)

print(E(A0))
0