結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 493 ms
50,992 KB
testcase_01 AC 502 ms
43,924 KB
testcase_02 AC 508 ms
44,180 KB
testcase_03 AC 524 ms
44,308 KB
testcase_04 AC 520 ms
44,304 KB
testcase_05 AC 501 ms
44,056 KB
testcase_06 AC 499 ms
44,312 KB
testcase_07 AC 504 ms
44,048 KB
testcase_08 AC 501 ms
44,052 KB
testcase_09 AC 489 ms
44,056 KB
testcase_10 AC 496 ms
44,292 KB
testcase_11 AC 494 ms
44,304 KB
testcase_12 AC 501 ms
44,056 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):
        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