結果

問題 No.144 エラトステネスのざる
ユーザー gigurururugigurururu
提出日時 2015-02-06 01:20:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 190 ms / 2,000 ms
コード長 144 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 87,164 KB
実行使用メモリ 92,840 KB
最終ジャッジ日時 2023-09-05 14:16:16
合計ジャッジ時間 3,577 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,428 KB
testcase_01 AC 76 ms
71,444 KB
testcase_02 AC 76 ms
71,324 KB
testcase_03 AC 76 ms
71,292 KB
testcase_04 AC 77 ms
71,136 KB
testcase_05 AC 77 ms
71,488 KB
testcase_06 AC 81 ms
76,464 KB
testcase_07 AC 81 ms
76,212 KB
testcase_08 AC 82 ms
76,520 KB
testcase_09 AC 80 ms
76,540 KB
testcase_10 AC 81 ms
76,480 KB
testcase_11 AC 81 ms
76,564 KB
testcase_12 AC 81 ms
76,576 KB
testcase_13 AC 173 ms
92,640 KB
testcase_14 AC 177 ms
92,808 KB
testcase_15 AC 178 ms
92,820 KB
testcase_16 AC 177 ms
92,840 KB
testcase_17 AC 185 ms
92,792 KB
testcase_18 AC 190 ms
92,784 KB
testcase_19 AC 182 ms
92,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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