結果
問題 |
No.144 エラトステネスのざる
|
ユーザー |
|
提出日時 | 2020-04-08 07:22:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 331 bytes |
コンパイル時間 | 1,511 ms |
コンパイル使用メモリ | 169,048 KB |
実行使用メモリ | 7,692 KB |
最終ジャッジ日時 | 2024-07-18 00:40:31 |
合計ジャッジ時間 | 2,496 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 WA * 3 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; int main() { int n; cin >> n; double p; cin >> p; vector<int> div(n+1); for(int i = 2;i<=n;i++) { for(int j = i;j<=n;j+=i) { div[j]++; } } double ans = 0; for(int i = 2;i<=n;i++) { ans += pow(1-p,div[i]-1); } cout<<ans<<endl; return 0; }