結果

問題 No.144 エラトステネスのざる
ユーザー roarisroaris
提出日時 2019-08-04 14:34:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 250 ms / 2,000 ms
コード長 259 bytes
コンパイル時間 996 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 85,560 KB
最終ジャッジ日時 2023-09-22 15:37:37
合計ジャッジ時間 3,846 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,472 KB
testcase_01 AC 71 ms
71,292 KB
testcase_02 AC 72 ms
71,516 KB
testcase_03 AC 72 ms
71,384 KB
testcase_04 AC 75 ms
71,444 KB
testcase_05 AC 73 ms
71,400 KB
testcase_06 AC 77 ms
76,348 KB
testcase_07 AC 75 ms
76,576 KB
testcase_08 AC 77 ms
76,840 KB
testcase_09 AC 76 ms
76,864 KB
testcase_10 AC 77 ms
76,876 KB
testcase_11 AC 76 ms
76,780 KB
testcase_12 AC 77 ms
76,584 KB
testcase_13 AC 199 ms
85,028 KB
testcase_14 AC 243 ms
85,444 KB
testcase_15 AC 250 ms
85,492 KB
testcase_16 AC 246 ms
85,412 KB
testcase_17 AC 248 ms
85,560 KB
testcase_18 AC 249 ms
85,516 KB
testcase_19 AC 220 ms
85,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, p = input().split()
N, p = int(N), float(p)
divisors_cnt = [0] * (N + 1)
ans = 0

for i in range(1, N+1):
    for j in range(i, N+1, i):
        divisors_cnt[j] += 1

for i in range(2, N+1):
    c = divisors_cnt[i]
    ans += (1 - p) ** (c - 2)

print(ans)
0