結果

問題 No.144 エラトステネスのざる
ユーザー gigurururugigurururu
提出日時 2015-02-06 01:19:33
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 185 ms / 2,000 ms
コード長 150 bytes
コンパイル時間 122 ms
コンパイル使用メモリ 77,256 KB
実行使用メモリ 94,856 KB
最終ジャッジ日時 2023-09-05 14:14:41
合計ジャッジ時間 3,550 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
76,188 KB
testcase_01 AC 77 ms
76,304 KB
testcase_02 AC 76 ms
76,444 KB
testcase_03 AC 77 ms
76,236 KB
testcase_04 AC 77 ms
76,184 KB
testcase_05 AC 76 ms
76,336 KB
testcase_06 AC 84 ms
78,684 KB
testcase_07 AC 83 ms
78,604 KB
testcase_08 AC 84 ms
78,804 KB
testcase_09 AC 83 ms
78,684 KB
testcase_10 AC 83 ms
79,040 KB
testcase_11 AC 82 ms
79,048 KB
testcase_12 AC 83 ms
79,004 KB
testcase_13 AC 181 ms
94,224 KB
testcase_14 AC 178 ms
94,196 KB
testcase_15 AC 178 ms
94,388 KB
testcase_16 AC 179 ms
94,856 KB
testcase_17 AC 175 ms
94,540 KB
testcase_18 AC 185 ms
94,224 KB
testcase_19 AC 179 ms
94,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,p=list(raw_input().split())
N,P=int(n),float(p)
l=[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[2:]))
0