結果

問題 No.144 エラトステネスのざる
ユーザー H3PO4H3PO4
提出日時 2020-05-06 11:10:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 238 bytes
コンパイル時間 472 ms
コンパイル使用メモリ 10,732 KB
実行使用メモリ 45,364 KB
最終ジャッジ日時 2023-09-10 20:00:41
合計ジャッジ時間 18,984 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
29,668 KB
testcase_01 AC 140 ms
29,636 KB
testcase_02 AC 139 ms
29,572 KB
testcase_03 AC 141 ms
29,540 KB
testcase_04 AC 140 ms
29,620 KB
testcase_05 AC 137 ms
29,624 KB
testcase_06 AC 138 ms
29,656 KB
testcase_07 AC 140 ms
29,632 KB
testcase_08 AC 141 ms
29,600 KB
testcase_09 AC 139 ms
29,664 KB
testcase_10 AC 138 ms
29,628 KB
testcase_11 AC 140 ms
29,832 KB
testcase_12 AC 139 ms
29,668 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

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

factor = np.zeros(N + 1, dtype=int)
for i in range(2, N + 1):
    factor[i * 2:N + 1:i] += 1

ans_lst = np.full(N - 1, 1 - P)
ans_lst **= factor[2:]
print(ans_lst.sum())
0