結果
問題 | No.2123 Chalk Breaker |
ユーザー | tnakao0123 |
提出日時 | 2022-11-11 17:51:50 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 21 ms / 2,000 ms |
コード長 | 518 bytes |
コンパイル時間 | 267 ms |
コンパイル使用メモリ | 41,076 KB |
実行使用メモリ | 4,352 KB |
最終ジャッジ日時 | 2023-10-11 14:10:21 |
合計ジャッジ時間 | 1,370 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 21 ms
4,348 KB |
testcase_01 | AC | 21 ms
4,348 KB |
testcase_02 | AC | 7 ms
4,352 KB |
testcase_03 | AC | 3 ms
4,352 KB |
testcase_04 | AC | 1 ms
4,352 KB |
testcase_05 | AC | 16 ms
4,352 KB |
testcase_06 | AC | 3 ms
4,348 KB |
testcase_07 | AC | 5 ms
4,352 KB |
testcase_08 | AC | 3 ms
4,348 KB |
testcase_09 | AC | 1 ms
4,352 KB |
ソースコード
/* -*- coding: utf-8 -*- * * 2123.cc: No.2123 Chalk Breaker - yukicoder */ #include<cstdio> #include<algorithm> using namespace std; /* constant */ const int MAX_N = 5000; /* typedef */ /* global variables */ double dp[MAX_N + 1]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); dp[0] = 0.0; for (int l = 1; l <= n; l++) { double s = 0.0; for (int j = 0; j < l; j++) s += dp[j] + dp[l - 1 - j]; dp[l] = 1.0 + s / l; } printf("%.12lf\n", dp[n]); return 0; }