結果
問題 |
No.144 エラトステネスのざる
|
ユーザー |
|
提出日時 | 2019-06-05 00:36:36 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 488 bytes |
コンパイル時間 | 994 ms |
コンパイル使用メモリ | 99,996 KB |
実行使用メモリ | 53,280 KB |
最終ジャッジ日時 | 2024-09-18 19:14:44 |
合計ジャッジ時間 | 4,547 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 TLE * 1 -- * 6 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <cmath> #include <iomanip> using namespace std; int main() { cin.tie(0); ios_base::sync_with_stdio(false); int N; map<int,int> m; double p,ans = 0.0; cin >> N >> p; for(int i = 2; i <= N; ++i){ for(int j = i*2; j <= N; j += i) ++m[j]; ans += pow(1-p,m[i]); } cout << fixed << setprecision(10) << ans << endl; return 0; }