結果
| 問題 | No.790 ちきんの括弧並べ |
| ユーザー |
|
| 提出日時 | 2020-04-18 01:25:25 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 600 bytes |
| 記録 | |
| コンパイル時間 | 467 ms |
| コンパイル使用メモリ | 91,520 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-06-09 15:00:52 |
| 合計ジャッジ時間 | 1,458 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
#include <iostream>
#include <vector>
template <class T>
std::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); }
void solve() {
int n;
std::cin >> n;
auto comb = vec(n * 2 + 1, vec(n * 2 + 1, 0));
comb[0][0] = 1;
for (int x = 0; x < n * 2; ++x) {
for (int y = 0; y <= x; ++y) {
comb[x + 1][y] += comb[x][y];
comb[x + 1][y + 1] += comb[x][y];
}
}
std::cout << comb[n * 2][n] / (n + 1) << std::endl;
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}