結果
問題 | No.144 エラトステネスのざる |
ユーザー |
|
提出日時 | 2021-06-26 12:35:58 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 188 ms / 2,000 ms |
コード長 | 289 bytes |
コンパイル時間 | 322 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 83,840 KB |
最終ジャッジ日時 | 2024-06-25 07:52:15 |
合計ジャッジ時間 | 2,880 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
n,p=input().split()n=int(n)p=1-float(p)mat=[0]*(n+1)# mat[i]:iが素数リストに残るために飛ばさないといけない処理の回数ans=0for i in range(2,n+1):ii=i+iwhile ii<=n:mat[ii]+=1ii+=ians+=pow(p,mat[i])print(ans)#print([pow(p,x) for x in mat])