結果

問題 No.144 エラトステネスのざる
ユーザー gigurururugigurururu
提出日時 2015-02-06 01:06:46
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 213 ms / 2,000 ms
コード長 172 bytes
コンパイル時間 1,149 ms
コンパイル使用メモリ 77,520 KB
実行使用メモリ 102,624 KB
最終ジャッジ日時 2023-09-05 14:08:20
合計ジャッジ時間 4,614 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
76,464 KB
testcase_01 AC 75 ms
76,296 KB
testcase_02 AC 75 ms
76,564 KB
testcase_03 AC 76 ms
76,728 KB
testcase_04 AC 76 ms
76,276 KB
testcase_05 AC 76 ms
76,292 KB
testcase_06 AC 83 ms
79,324 KB
testcase_07 AC 81 ms
79,292 KB
testcase_08 AC 81 ms
79,400 KB
testcase_09 AC 82 ms
79,364 KB
testcase_10 AC 82 ms
79,364 KB
testcase_11 AC 79 ms
79,396 KB
testcase_12 AC 82 ms
79,472 KB
testcase_13 AC 198 ms
101,960 KB
testcase_14 AC 212 ms
101,940 KB
testcase_15 AC 193 ms
101,964 KB
testcase_16 AC 213 ms
102,020 KB
testcase_17 AC 209 ms
101,988 KB
testcase_18 AC 208 ms
101,804 KB
testcase_19 AC 200 ms
102,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,p=list(raw_input().split())
N,P=int(n),float(p)
l=[0,0]+[1.0]*(N-1)
s=0
q=1-P
for i in xrange(2,N+1):
    s+=l[i]
    for j in xrange(i+i,N+1,i):
        l[j]*=q
print(s)
0