結果
| 問題 | No.144 エラトステネスのざる |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-29 02:22:41 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 501 bytes |
| 記録 | |
| コンパイル時間 | 1,611 ms |
| コンパイル使用メモリ | 169,408 KB |
| 実行使用メモリ | 14,032 KB |
| 最終ジャッジ日時 | 2024-10-07 16:23:27 |
| 合計ジャッジ時間 | 5,376 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 TLE * 1 -- * 6 |
ソースコード
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
double p;
cin >> p;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++) {
for (int j = i; j <= n; j += i) {
a[j]++;
}
}
for (int i = 2; i <= n; i++) {
cerr << i << " " << a[i] << endl;
}
double ans = 0;
for (int i = 2; i <= n; i++) {
ans += pow(1.0 - p, a[i] - 2);
}
cout << setprecision(20) << fixed << ans << '\n';
return 0;
}