結果

問題 No.790 ちきんの括弧並べ
ユーザー CuriousFairy315
提出日時 2019-02-20 22:25:46
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 266 bytes
コンパイル時間 496 ms
コンパイル使用メモリ 66,000 KB
最終ジャッジ日時 2025-01-06 21:18:15
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

int comb(int n, int m) { // nCm
	int ans = 1;
	for (int i = 0;i < m;++ i) {
		ans *= n - i;
		ans /= i + 1;
	}
	return ans;
}

int main() {
	int N;
	cin >> N;
	cout << comb(2 * N, N) / (N + 1); // カタラン数
	return 0;
}
0