結果
| 問題 | No.144 エラトステネスのざる |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-11-29 20:52:08 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 236 bytes |
| コンパイル時間 | 527 ms |
| コンパイル使用メモリ | 82,540 KB |
| 実行使用メモリ | 92,560 KB |
| 最終ジャッジ日時 | 2024-09-13 02:08:54 |
| 合計ジャッジ時間 | 4,430 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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))