結果
問題 | No.144 エラトステネスのざる |
ユーザー |
|
提出日時 | 2023-06-15 00:20:41 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 606 bytes |
コンパイル時間 | 3,393 ms |
コンパイル使用メモリ | 243,540 KB |
実行使用メモリ | 10,272 KB |
最終ジャッジ日時 | 2024-06-23 05:04:54 |
合計ジャッジ時間 | 24,525 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 TLE * 7 |
ソースコード
#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'; }