結果

問題 No.144 エラトステネスのざる
ユーザー tamuheytamuhey
提出日時 2019-07-02 23:50:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 439 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 10,896 KB
実行使用メモリ 43,808 KB
最終ジャッジ日時 2023-10-11 21:12:08
合計ジャッジ時間 8,138 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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