結果
| 問題 |
No.144 エラトステネスのざる
|
| コンテスト | |
| ユーザー |
a
|
| 提出日時 | 2023-11-14 00:40:27 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 434 bytes |
| コンパイル時間 | 4,679 ms |
| コンパイル使用メモリ | 310,544 KB |
| 実行使用メモリ | 11,536 KB |
| 最終ジャッジ日時 | 2024-09-26 03:28:04 |
| 合計ジャッジ時間 | 11,894 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 TLE * 7 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
int main() {
int N;
double p;
cin >> N >> p;
vector<double> dp(N + 1, 1);
double ans = 0;
for (int x = 2; x <= N; x++) {
ans += dp[x];
for (int i = 2; x * i <= N; i++) {
dp[x * i] *= 1 - p;
}
cerr << dp[x] << ' ';
}
cerr << endl;
cout << fixed << setprecision(10) << ans << endl;
}
a