結果
問題 |
No.144 エラトステネスのざる
|
ユーザー |
|
提出日時 | 2019-06-05 00:45:00 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 55 ms / 2,000 ms |
コード長 | 484 bytes |
コンパイル時間 | 845 ms |
コンパイル使用メモリ | 91,356 KB |
実行使用メモリ | 7,808 KB |
最終ジャッジ日時 | 2024-09-18 21:43:34 |
合計ジャッジ時間 | 2,031 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 |
ソースコード
#include <iostream> #include <algorithm> #include <vector> #include <set> #include <map> #include <queue> #include <cmath> #include <iomanip> using namespace std; int m[1000010]; int main() { cin.tie(0); ios_base::sync_with_stdio(false); int N; 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; }