結果
問題 |
No.144 エラトステネスのざる
|
ユーザー |
![]() |
提出日時 | 2020-11-02 16:14:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 570 bytes |
コンパイル時間 | 618 ms |
コンパイル使用メモリ | 75,108 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-22 06:20:34 |
合計ジャッジ時間 | 21,098 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 TLE * 7 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <iomanip> using namespace std; using ld = long double; int main() { int n; ld p; cin >> n >> p; ld ret = 1; for (int i = 3; i <= n; i++) { ld count = 0; for (int j = 2; j * j <= i; j++) { if (i % j == 0) { count++; if (j * j != i)count++; } } ld now = 1; while (count--)now *= (1 - p); ret += now; } cout << fixed << setprecision(15) << ret << endl; return 0; }