結果

問題 No.144 エラトステネスのざる
ユーザー nohtaraynohtaray
提出日時 2019-11-18 14:13:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 415 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 59,008 KB
最終ジャッジ日時 2024-04-09 02:48:54
合計ジャッジ時間 13,501 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 529 ms
51,136 KB
testcase_01 AC 526 ms
44,104 KB
testcase_02 AC 523 ms
44,584 KB
testcase_03 AC 532 ms
44,192 KB
testcase_04 AC 530 ms
44,320 KB
testcase_05 AC 530 ms
44,456 KB
testcase_06 AC 533 ms
44,324 KB
testcase_07 AC 530 ms
44,312 KB
testcase_08 AC 535 ms
44,452 KB
testcase_09 AC 530 ms
44,076 KB
testcase_10 AC 529 ms
44,068 KB
testcase_11 AC 531 ms
44,576 KB
testcase_12 AC 538 ms
44,072 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import os
import sys

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353

N, P = list(map(float, sys.stdin.buffer.readline().split()))
N = int(N)

exp = np.ones(N + 1)
exp[0] = 0
exp[1] = 0

for n, e in enumerate(exp[2:], 2):
    exp[n + n::n] *= 1 - P
# print(exp)
print(exp.sum())
0