結果

問題 No.144 エラトステネスのざる
ユーザー yuki2006yuki2006
提出日時 2015-02-05 19:31:19
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 169 ms / 2,000 ms
コード長 244 bytes
コンパイル時間 1,286 ms
コンパイル使用メモリ 77,736 KB
実行使用メモリ 87,164 KB
最終ジャッジ日時 2023-09-05 12:53:19
合計ジャッジ時間 4,634 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
76,484 KB
testcase_01 AC 73 ms
76,340 KB
testcase_02 AC 72 ms
76,228 KB
testcase_03 AC 74 ms
76,152 KB
testcase_04 AC 74 ms
76,676 KB
testcase_05 AC 72 ms
76,488 KB
testcase_06 AC 86 ms
79,260 KB
testcase_07 AC 79 ms
79,444 KB
testcase_08 AC 81 ms
79,228 KB
testcase_09 AC 81 ms
79,296 KB
testcase_10 AC 81 ms
79,028 KB
testcase_11 AC 82 ms
79,244 KB
testcase_12 AC 82 ms
79,260 KB
testcase_13 AC 164 ms
86,912 KB
testcase_14 AC 168 ms
87,104 KB
testcase_15 AC 165 ms
87,000 KB
testcase_16 AC 162 ms
86,904 KB
testcase_17 AC 162 ms
87,164 KB
testcase_18 AC 169 ms
87,024 KB
testcase_19 AC 167 ms
87,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, p = map(float, raw_input().split())
N = int(N)

prime = [1.0] * (N + 1)

for v in xrange(2, N + 1):
    for i in xrange(v + v, N + 1, v):
        prime[i] *= 1 - p

total = 0
for prob in xrange(2, N + 1):
    total += prime[prob]
print total
0