結果
| 問題 |
No.790 ちきんの括弧並べ
|
| ユーザー |
|
| 提出日時 | 2019-02-19 20:58:22 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 2,000 ms |
| コード長 | 885 bytes |
| コンパイル時間 | 847 ms |
| コンパイル使用メモリ | 78,836 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 19:34:16 |
| 合計ジャッジ時間 | 1,457 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
#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, ll startN) {
if (length == 0 && state == 0) return 1;
if (length == 0 && state != 0) return 0;
if (state < 0) return 0;
if (startN > 0) return recurse(state + 1, length - 1, startN - 1) + recurse(state - 1, length - 1, startN);
else if (state - length == 0) return 1;
else return 0;
}
int main() {
IN >> N;
OUT << recurse(0, N * 2, N) << endl;
return 0;
}