백준 13699 c++

magicdrill·2024년 8월 22일

백준 문제풀이

목록 보기
424/673

백준 13699 c++

DP문제를 다시 쉬운거부터 시작해보겠다.

#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

long long t(long long n)
{
	int i, j;
	vector <long long> dp(36, 0);

	dp[0] = 1;
	for (i = 1; i <= n; i++)
	{
		for (j = 0; j < i; j++)
		{
			dp[i] += dp[j] * dp[i - j - 1];
		}
	}

	return dp[n];
}

int main(void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	long long n;

	cin >> n;
	cout << t(n) << "\n";

	return 0;
}

0개의 댓글