結果
| 問題 | No.144 エラトステネスのざる |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-06-15 00:20:41 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1,268 ms / 2,000 ms |
| コード長 | 606 bytes |
| 記録 | |
| コンパイル時間 | 3,077 ms |
| コンパイル使用メモリ | 334,324 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-03-07 20:11:08 |
| 合計ジャッジ時間 | 12,642 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.hpp"
#else
#define debug(...) 1
#endif
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
double p;
cin >> p;
double ans = 0;
for (int i = 2; i <= n; i++) {
int cnt = 0;
for (int j = 2; j * j <= i; j++) {
if (i % j == 0) {
cnt++;
if (j != i / j) {
cnt++;
}
}
}
ans += pow(1 - p, cnt);
}
cout << fixed << setprecision(15) << ans << '\n';
}