結果

問題 No.790 ちきんの括弧並べ
ユーザー Kuske
提出日時 2019-02-19 20:47:52
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 778 bytes
コンパイル時間 688 ms
コンパイル使用メモリ 80,256 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-12 19:13:24
合計ジャッジ時間 1,314 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <vector>
#include <queue>
#include <functional>
#include <math.h>
#include <string.h>

using std::endl;
using std::string;

#define ll long long int
#define LEP(a, n) for(ll a = 0; a < n; ++a)
#define INF 123456789012345
#define OUT std::cout
#define IN std::cin
#define itn int
#define fro for
#define sdt std

ll N;

ll recurse(ll state, ll length) {
	if (length == 0 && state == 0) return 1;
	if (length == 0 && state != 0) return 0;
	if (state < 0) return 0;
	return recurse(state + 1, length - 1) + recurse(state - 1, length - 1);
}

int main() {
	IN >> N;
	OUT << recurse(0, N * 2) << endl;

	return 0;
}
0