結果
問題 |
No.144 エラトステネスのざる
|
ユーザー |
|
提出日時 | 2020-11-29 15:18:47 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 236 bytes |
コンパイル時間 | 97 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 18,080 KB |
最終ジャッジ日時 | 2024-09-13 01:59:48 |
合計ジャッジ時間 | 3,766 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 3 TLE * 1 -- * 13 |
ソースコード
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))