結果

問題 No.144 エラトステネスのざる
ユーザー gigurururugigurururu
提出日時 2015-02-06 01:03:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 217 ms / 2,000 ms
コード長 166 bytes
コンパイル時間 477 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 100,656 KB
最終ジャッジ日時 2023-09-05 14:07:27
合計ジャッジ時間 4,616 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,464 KB
testcase_01 AC 78 ms
71,508 KB
testcase_02 AC 78 ms
71,476 KB
testcase_03 AC 77 ms
71,352 KB
testcase_04 AC 77 ms
71,364 KB
testcase_05 AC 76 ms
71,360 KB
testcase_06 AC 82 ms
76,808 KB
testcase_07 AC 82 ms
76,664 KB
testcase_08 AC 82 ms
76,796 KB
testcase_09 AC 83 ms
76,980 KB
testcase_10 AC 82 ms
76,904 KB
testcase_11 AC 83 ms
76,820 KB
testcase_12 AC 84 ms
76,704 KB
testcase_13 AC 195 ms
100,600 KB
testcase_14 AC 209 ms
100,488 KB
testcase_15 AC 203 ms
100,656 KB
testcase_16 AC 207 ms
100,460 KB
testcase_17 AC 207 ms
100,456 KB
testcase_18 AC 217 ms
100,280 KB
testcase_19 AC 206 ms
100,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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