結果

問題 No.144 エラトステネスのざる
ユーザー tamuhey
提出日時 2019-07-02 23:50:27
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 439 bytes
コンパイル時間 232 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 46,464 KB
最終ジャッジ日時 2024-09-13 20:04:33
合計ジャッジ時間 9,624 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 RE * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

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)+1):
            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()
0