結果

問題 No.144 エラトステネスのざる
ユーザー AT274_AT274_
提出日時 2019-10-24 21:52:26
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 258 ms / 2,000 ms
コード長 256 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,072 KB
実行使用メモリ 85,480 KB
最終ジャッジ日時 2023-09-25 07:50:56
合計ジャッジ時間 4,098 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,500 KB
testcase_01 AC 69 ms
71,228 KB
testcase_02 AC 69 ms
71,564 KB
testcase_03 AC 72 ms
71,436 KB
testcase_04 AC 68 ms
71,372 KB
testcase_05 AC 68 ms
71,272 KB
testcase_06 AC 74 ms
76,248 KB
testcase_07 AC 73 ms
76,604 KB
testcase_08 AC 74 ms
76,928 KB
testcase_09 AC 73 ms
76,532 KB
testcase_10 AC 75 ms
76,672 KB
testcase_11 AC 74 ms
76,664 KB
testcase_12 AC 73 ms
76,408 KB
testcase_13 AC 192 ms
84,932 KB
testcase_14 AC 236 ms
85,304 KB
testcase_15 AC 246 ms
85,404 KB
testcase_16 AC 258 ms
85,356 KB
testcase_17 AC 235 ms
85,204 KB
testcase_18 AC 235 ms
85,480 KB
testcase_19 AC 204 ms
85,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

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

print(ans)
0