結果

問題 No.144 エラトステネスのざる
ユーザー H3PO4H3PO4
提出日時 2020-05-06 11:04:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 223 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 10,664 KB
実行使用メモリ 23,848 KB
最終ジャッジ日時 2023-09-10 19:47:30
合計ジャッジ時間 18,417 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,860 KB
testcase_01 AC 15 ms
7,804 KB
testcase_02 AC 15 ms
7,776 KB
testcase_03 AC 16 ms
7,780 KB
testcase_04 AC 15 ms
7,884 KB
testcase_05 AC 15 ms
7,968 KB
testcase_06 AC 17 ms
7,884 KB
testcase_07 AC 17 ms
7,968 KB
testcase_08 AC 17 ms
7,836 KB
testcase_09 AC 17 ms
7,884 KB
testcase_10 AC 16 ms
7,888 KB
testcase_11 AC 17 ms
7,968 KB
testcase_12 AC 17 ms
7,852 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

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

ans = .0
for x in factor[2:]:
    ans += (1 - P) ** x
print(ans)
0