結果

問題 No.790 ちきんの括弧並べ
ユーザー KuskeKuske
提出日時 2019-02-19 20:47:52
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 778 bytes
コンパイル時間 497 ms
コンパイル使用メモリ 78,348 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 21:02:55
合計ジャッジ時間 1,076 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 12 ms
5,376 KB
testcase_09 AC 43 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 4 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

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