結果

問題 No.144 エラトステネスのざる
ユーザー nohakai3nohakai3
提出日時 2022-11-05 12:12:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 284 ms / 2,000 ms
コード長 148 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 86,948 KB
実行使用メモリ 92,476 KB
最終ジャッジ日時 2023-09-26 11:53:59
合計ジャッジ時間 4,387 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,200 KB
testcase_01 AC 76 ms
71,220 KB
testcase_02 AC 77 ms
71,256 KB
testcase_03 AC 76 ms
71,272 KB
testcase_04 AC 77 ms
71,316 KB
testcase_05 AC 73 ms
71,460 KB
testcase_06 AC 87 ms
76,464 KB
testcase_07 AC 81 ms
76,504 KB
testcase_08 AC 80 ms
76,760 KB
testcase_09 AC 82 ms
76,340 KB
testcase_10 AC 81 ms
76,432 KB
testcase_11 AC 81 ms
76,520 KB
testcase_12 AC 83 ms
76,396 KB
testcase_13 AC 260 ms
92,252 KB
testcase_14 AC 274 ms
92,144 KB
testcase_15 AC 254 ms
92,312 KB
testcase_16 AC 255 ms
92,360 KB
testcase_17 AC 266 ms
92,476 KB
testcase_18 AC 284 ms
92,344 KB
testcase_19 AC 251 ms
92,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,p=map(float,input().split())
n=int(n)
l=[1]*(n+1)

for i in range(2,n+1):
    for j in range(2*i,n+1,i):
        l[j]=l[j]*(1-p)

print(sum(l)-2)
0