結果

問題 No.144 エラトステネスのざる
ユーザー shinshin
提出日時 2022-11-20 11:43:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 266 bytes
コンパイル時間 551 ms
コンパイル使用メモリ 11,916 KB
実行使用メモリ 17,860 KB
最終ジャッジ日時 2023-10-21 11:23:31
合計ジャッジ時間 7,469 ms
ジャッジサーバーID
(参考情報)
judge13 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,240 KB
testcase_01 AC 26 ms
10,208 KB
testcase_02 AC 27 ms
10,300 KB
testcase_03 AC 29 ms
10,180 KB
testcase_04 AC 30 ms
10,180 KB
testcase_05 AC 27 ms
10,180 KB
testcase_06 AC 28 ms
10,180 KB
testcase_07 AC 27 ms
10,268 KB
testcase_08 AC 29 ms
10,208 KB
testcase_09 AC 27 ms
10,268 KB
testcase_10 AC 28 ms
10,268 KB
testcase_11 AC 27 ms
10,268 KB
testcase_12 AC 27 ms
10,208 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#エラトステネスのざる
import math

n , p = input().split()

N = int(n)
P = float(p)

l = [0] * (N + 1)

for i in range(2 , N + 1):
    for j in range(2 , N // i + 1):
        l[i * j] += 1
    
ans = 0

for i in l:
    ans += (1 - P) ** i


print(ans - 2)
0