結果

問題 No.144 エラトステネスのざる
ユーザー roiti46roiti46
提出日時 2015-02-12 00:46:24
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 172 bytes
コンパイル時間 50 ms
コンパイル使用メモリ 6,732 KB
実行使用メモリ 84,156 KB
最終ジャッジ日時 2023-09-05 23:51:04
合計ジャッジ時間 4,229 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
10,312 KB
testcase_01 AC 11 ms
5,988 KB
testcase_02 AC 11 ms
5,956 KB
testcase_03 AC 11 ms
5,876 KB
testcase_04 AC 11 ms
5,904 KB
testcase_05 AC 11 ms
5,956 KB
testcase_06 AC 13 ms
5,908 KB
testcase_07 AC 13 ms
5,972 KB
testcase_08 AC 13 ms
5,932 KB
testcase_09 AC 13 ms
6,020 KB
testcase_10 AC 13 ms
6,072 KB
testcase_11 AC 15 ms
5,968 KB
testcase_12 AC 13 ms
6,028 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)
P = [1]*(N+1)
P[0] = P[1] = 0
ans = 0
for i in range(2,N+1):
    for j in range(2*i,N+1,i):
        P[j] *= 1-p
print sum(P)
0