結果

問題 No.144 エラトステネスのざる
ユーザー convexineqconvexineq
提出日時 2020-12-08 04:44:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 242 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 81,800 KB
実行使用メモリ 83,308 KB
最終ジャッジ日時 2023-10-17 16:55:25
合計ジャッジ時間 2,992 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,528 KB
testcase_01 AC 36 ms
53,528 KB
testcase_02 AC 37 ms
53,532 KB
testcase_03 AC 37 ms
53,524 KB
testcase_04 AC 36 ms
53,524 KB
testcase_05 AC 41 ms
53,524 KB
testcase_06 AC 44 ms
60,196 KB
testcase_07 AC 43 ms
60,196 KB
testcase_08 AC 44 ms
60,196 KB
testcase_09 AC 43 ms
60,196 KB
testcase_10 AC 43 ms
60,196 KB
testcase_11 AC 41 ms
60,196 KB
testcase_12 AC 42 ms
60,196 KB
testcase_13 AC 144 ms
83,304 KB
testcase_14 AC 156 ms
83,304 KB
testcase_15 AC 157 ms
83,304 KB
testcase_16 AC 152 ms
83,304 KB
testcase_17 AC 161 ms
83,304 KB
testcase_18 AC 137 ms
83,308 KB
testcase_19 AC 141 ms
83,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,p = input().split()
n = int(n)
p = float(p)
ans = 0
num = [0]*(n+1)
prob = [1]*1000
for i in range(1,1000): prob[i] = prob[i-1]*(1-p)
for i in range(2,n+1):
    ans += prob[num[i]]
    for j in range(i,n+1,i):
        num[j] += 1
print(ans)
0