結果

問題 No.2123 Chalk Breaker
ユーザー yansi819
提出日時 2024-03-20 10:21:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 421 bytes
コンパイル時間 4,420 ms
コンパイル使用メモリ 257,444 KB
最終ジャッジ日時 2025-02-20 08:01:34
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 1
other TLE * 1 -- * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;

int N;
map<int, double> mp;

double f(int n) {
  if (mp.count(n)) return mp[n];
  if (n == 0) return 0;
  double sum = 0;
  for (int i = 0; i < n; i++) sum += f(i) + f(n - i - 1);
  return mp[n] = sum / n + 1;
}

int main() {
  cin >> N;
  cout << fixed << setprecision(15) << f(N) << endl;
  return 0;
}
0