結果
問題 |
No.144 エラトステネスのざる
|
ユーザー |
|
提出日時 | 2020-06-22 22:25:49 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 303 bytes |
コンパイル時間 | 177 ms |
コンパイル使用メモリ | 82,284 KB |
実行使用メモリ | 102,120 KB |
最終ジャッジ日時 | 2024-07-03 18:56:37 |
合計ジャッジ時間 | 6,346 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 TLE * 2 -- * 5 |
ソースコード
from decimal import Decimal n, p = input().split() n = int(n) p = Decimal(p) cnt = [0] * (n + 1) for i in range(2, n + 1): cnt[i] += 1 for j in range(i * 2, n + 1, i): cnt[j] += 1 #print(cnt) res = cnt.count(1) for c in cnt: if c > 1: res += (1 - p) ** (c - 1) print(res)