結果

問題 No.144 エラトステネスのざる
ユーザー gigurururugigurururu
提出日時 2015-02-06 01:09:38
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 226 ms / 2,000 ms
コード長 152 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 78,044 KB
実行使用メモリ 102,424 KB
最終ジャッジ日時 2023-09-05 14:08:51
合計ジャッジ時間 3,853 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
76,268 KB
testcase_01 AC 76 ms
76,236 KB
testcase_02 AC 79 ms
76,228 KB
testcase_03 AC 77 ms
76,504 KB
testcase_04 AC 81 ms
76,148 KB
testcase_05 AC 76 ms
76,516 KB
testcase_06 AC 85 ms
79,108 KB
testcase_07 AC 82 ms
79,184 KB
testcase_08 AC 84 ms
78,868 KB
testcase_09 AC 83 ms
78,904 KB
testcase_10 AC 83 ms
79,432 KB
testcase_11 AC 83 ms
78,896 KB
testcase_12 AC 82 ms
79,180 KB
testcase_13 AC 192 ms
102,424 KB
testcase_14 AC 219 ms
101,652 KB
testcase_15 AC 221 ms
102,256 KB
testcase_16 AC 223 ms
101,816 KB
testcase_17 AC 211 ms
101,536 KB
testcase_18 AC 223 ms
101,372 KB
testcase_19 AC 226 ms
101,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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