結果
| 問題 |
No.144 エラトステネスのざる
|
| コンテスト | |
| ユーザー |
yamachaso55
|
| 提出日時 | 2021-05-20 19:24:31 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 961 bytes |
| コンパイル時間 | 2,030 ms |
| コンパイル使用メモリ | 194,164 KB |
| 最終ジャッジ日時 | 2025-01-21 13:59:26 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 3 |
ソースコード
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
// #include <atcoder/all> // g++ main.cpp -std=c++17 -I .
using namespace std;
// using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
using ll=long long;
const int inf = INT_MAX / 2; const ll INF = 1LL << 60;
const int MOD = 1000000007;
//cout << fixed << setprecision(15) << x << endl;
// using mint = modint1000000007;
////////////////////////////////////////////////////////////////////////////////////////////
int main() {
int n;
double p;
cin>>n>>p;
vector<int> v(n+1);
double ans = 0;
for(int i = 2; i <= n; i++) {
for(int j = i; j <= n; j += i) {
v[j]++;
}
ans += pow(1-p, v[i]-1);
}
cout << ans << endl;
return 0;
}
yamachaso55