結果

問題 No.144 エラトステネスのざる
ユーザー tamuheytamuhey
提出日時 2019-07-02 23:52:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 437 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 10,828 KB
実行使用メモリ 8,000 KB
最終ジャッジ日時 2023-10-11 21:11:59
合計ジャッジ時間 4,991 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 15 ms
7,928 KB
testcase_02 WA -
testcase_03 AC 16 ms
7,788 KB
testcase_04 AC 16 ms
7,932 KB
testcase_05 AC 16 ms
7,748 KB
testcase_06 AC 17 ms
7,796 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

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)):
            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