Created
February 20, 2019 05:50
-
-
Save lapla-cogito/98afc076a12bc483340af7659afb5f98 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment