結果

問題 No.144 エラトステネスのざる
ユーザー takakintakakin
提出日時 2020-05-06 22:27:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 243 ms / 2,000 ms
コード長 241 bytes
コンパイル時間 331 ms
コンパイル使用メモリ 87,272 KB
実行使用メモリ 85,272 KB
最終ジャッジ日時 2023-09-16 07:35:14
合計ジャッジ時間 3,873 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,452 KB
testcase_01 AC 72 ms
71,164 KB
testcase_02 AC 72 ms
71,456 KB
testcase_03 AC 76 ms
71,444 KB
testcase_04 AC 72 ms
70,964 KB
testcase_05 AC 74 ms
71,152 KB
testcase_06 AC 80 ms
75,800 KB
testcase_07 AC 78 ms
76,404 KB
testcase_08 AC 78 ms
76,404 KB
testcase_09 AC 78 ms
76,608 KB
testcase_10 AC 79 ms
76,400 KB
testcase_11 AC 78 ms
76,368 KB
testcase_12 AC 78 ms
76,248 KB
testcase_13 AC 194 ms
84,936 KB
testcase_14 AC 242 ms
85,232 KB
testcase_15 AC 243 ms
85,232 KB
testcase_16 AC 242 ms
85,088 KB
testcase_17 AC 238 ms
85,148 KB
testcase_18 AC 242 ms
85,272 KB
testcase_19 AC 215 ms
84,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n,p=map(float,input().split())
n=int(n)
D=[0]*(n+1)
for i in range(2,n+1):
  for j in range(1,n//i+1):
    D[i*j]+=1
ans=0
for i in range(2,n+1):
  ans+=pow(1-p,max(0,D[i]-1))
print(ans)
0