結果

問題 No.144 エラトステネスのざる
ユーザー gorugo30gorugo30
提出日時 2021-03-16 22:24:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 179 ms / 2,000 ms
コード長 224 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 82,452 KB
実行使用メモリ 84,224 KB
最終ジャッジ日時 2024-04-26 05:05:25
合計ジャッジ時間 2,739 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,596 KB
testcase_01 AC 34 ms
52,744 KB
testcase_02 AC 41 ms
53,076 KB
testcase_03 AC 39 ms
53,396 KB
testcase_04 AC 37 ms
52,616 KB
testcase_05 AC 38 ms
53,848 KB
testcase_06 AC 42 ms
60,344 KB
testcase_07 AC 42 ms
61,028 KB
testcase_08 AC 43 ms
60,152 KB
testcase_09 AC 47 ms
61,148 KB
testcase_10 AC 43 ms
59,820 KB
testcase_11 AC 43 ms
59,624 KB
testcase_12 AC 43 ms
60,220 KB
testcase_13 AC 151 ms
84,096 KB
testcase_14 AC 179 ms
84,224 KB
testcase_15 AC 172 ms
84,208 KB
testcase_16 AC 167 ms
84,224 KB
testcase_17 AC 170 ms
84,100 KB
testcase_18 AC 177 ms
84,080 KB
testcase_19 AC 165 ms
84,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, p = input().split()
N = int(N)
p = float(p)

cnt = [0] * (N + 1)
for x in range(2, N + 1):
    for y in range(2 * x, N + 1, x):
        cnt[y] += 1
ans = 0
for i in range(2, N + 1):
    ans += (1 - p) ** cnt[i]
print(ans)
0