結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 537 ms
43,928 KB
testcase_01 AC 535 ms
44,572 KB
testcase_02 WA -
testcase_03 AC 530 ms
43,796 KB
testcase_04 AC 540 ms
44,044 KB
testcase_05 AC 532 ms
44,180 KB
testcase_06 AC 536 ms
44,064 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 523 ms
44,064 KB
testcase_13 AC 638 ms
59,828 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 635 ms
60,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

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

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

print(solve(N, p))
0