結果

問題 No.144 エラトステネスのざる
ユーザー Yuki IwatakeYuki Iwatake
提出日時 2020-11-30 22:52:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 291 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 10,732 KB
実行使用メモリ 33,484 KB
最終ジャッジ日時 2023-10-11 03:07:29
合計ジャッジ時間 18,852 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
29,740 KB
testcase_01 AC 131 ms
29,752 KB
testcase_02 AC 132 ms
29,784 KB
testcase_03 AC 135 ms
29,692 KB
testcase_04 AC 132 ms
29,712 KB
testcase_05 AC 132 ms
29,628 KB
testcase_06 AC 135 ms
29,780 KB
testcase_07 AC 132 ms
29,764 KB
testcase_08 AC 132 ms
29,764 KB
testcase_09 AC 133 ms
29,764 KB
testcase_10 AC 132 ms
29,696 KB
testcase_11 AC 134 ms
29,712 KB
testcase_12 AC 131 ms
29,768 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)

dp = np.zeros(N+1, np.int32)

for i in range(1, int(N**.5)+10):
    if i * i > N:
        break
    dp[i*i]+=1
    dp[i*(i+1):N+1:i] += 2
    
dp -= 2
    
ans = 0
for i in range(2,N+1):
    ans += (1-p)**(dp[i])
print(ans)
0