結果

問題 No.144 エラトステネスのざる
ユーザー poet_nayutapoet_nayuta
提出日時 2018-08-19 17:24:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 286 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 67,324 KB
最終ジャッジ日時 2024-04-28 20:20:39
合計ジャッジ時間 12,748 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 524 ms
51,192 KB
testcase_01 AC 527 ms
44,244 KB
testcase_02 WA -
testcase_03 AC 524 ms
44,508 KB
testcase_04 AC 527 ms
44,248 KB
testcase_05 AC 525 ms
43,736 KB
testcase_06 AC 533 ms
44,252 KB
testcase_07 AC 526 ms
44,232 KB
testcase_08 WA -
testcase_09 AC 524 ms
44,252 KB
testcase_10 AC 524 ms
43,860 KB
testcase_11 AC 529 ms
44,256 KB
testcase_12 AC 527 ms
43,980 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

def solve(N, p):
    ps = np.ones(N+1)
    for i in range(2, (N+1)//2):
        ind = np.arange((N+i)//i) * i
        if ps[ind[1]] > 1e-5:
            ps[ind[2:]] *= (1 - p)
    return ps[2:].sum()

N, p = input().split()
N = int(N)
p = float(p)

print(solve(N, p))
0