結果

問題 No.144 エラトステネスのざる
ユーザー yuki2006yuki2006
提出日時 2015-02-05 19:41:05
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 213 bytes
コンパイル時間 523 ms
コンパイル使用メモリ 6,688 KB
実行使用メモリ 40,076 KB
最終ジャッジ日時 2023-09-05 12:53:58
合計ジャッジ時間 4,422 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
10,324 KB
testcase_01 AC 11 ms
5,960 KB
testcase_02 AC 11 ms
5,832 KB
testcase_03 AC 11 ms
5,876 KB
testcase_04 AC 11 ms
6,052 KB
testcase_05 AC 11 ms
5,920 KB
testcase_06 AC 12 ms
5,948 KB
testcase_07 AC 12 ms
5,832 KB
testcase_08 AC 13 ms
5,856 KB
testcase_09 AC 12 ms
5,996 KB
testcase_10 AC 13 ms
5,892 KB
testcase_11 AC 12 ms
5,856 KB
testcase_12 AC 12 ms
5,944 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

prime = [1.0] * (N + 1)

total = 0

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

    total += prime[v]

print total
0