結果
問題 |
No.144 エラトステネスのざる
|
ユーザー |
|
提出日時 | 2019-07-02 23:52:42 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 437 bytes |
コンパイル時間 | 120 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 52,864 KB |
最終ジャッジ日時 | 2024-09-13 20:04:22 |
合計ジャッジ時間 | 4,337 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 4 WA * 6 TLE * 1 -- * 6 |
ソースコード
import os def main(): n, p = input().split() n = int(n) p = float(p) dp = [1. for _ in range(n+1)] for i in range(2, len(dp)): for j in range(2,int(len(dp)/i)): dp[i*j] *= 1-p dp = dp[2:] print(sum(dp)) if os.getenv("DEBUG"): from pathlib import Path f = open(str(Path(__file__).parent / "input.txt")) input = f.readline while True: main() else: main()