結果
問題 | No.2123 Chalk Breaker |
ユーザー |
![]() |
提出日時 | 2023-03-07 16:31:18 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 947 bytes |
コンパイル時間 | 900 ms |
コンパイル使用メモリ | 81,832 KB |
最終ジャッジ日時 | 2025-02-11 06:15:21 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | TLE * 9 |
ソースコード
#define PROBLEM "https://yukicoder.me/problems/no/117" #include <iostream> #include <iomanip> #include <vector> auto Y = [](auto f) { return [=](auto&&... args) { return f(f, std::forward<decltype(args)>(args)...); }; }; using ll = long long; using std::cout; using std::cin; constexpr char endl = '\n'; struct Preprocessing { Preprocessing() { std::cin.tie(0); std::ios::sync_with_stdio(0); }; }_Preprocessing; signed main() { ll n; cin >> n; constexpr double nil = -1.0; std::vector<double> dp(n + 1, nil); auto f = Y([&](auto&& self, ll n) -> double { if(n == 0) { return 0.0; } if(dp[n] != nil) { return dp[n]; } double ans = 1.0; for(int x = 0; x < n; ++x) { int y = n - x - 1; ans += self(self, x); ans += self(self, y); } return ans / n; }); cout << std::fixed << std::setprecision(12) << f(n) << endl; }