Untitled

mail@pastecode.io avatar
unknown
plain_text
4 years ago
416 B
3
Indexable
Never
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int dp[23][23];
int solve(int i, int j) {
	if (i == 1 && j == 1)
		return 1;
	if (dp[i][j] != -1)
		return dp[i][j];
	return dp[i][j] = (solve(i - 1, j) + solve(i, j - 1));
}
signed main() {
	int n, m;
	scanf("%d%d", &n, &m);
	n++;
	m++;
	for (int i = 0; i < 22; ++i)
		for (int j = 0; j < 22; ++j)
			dp[i][j] = -1;
	printf("%d", solve(n, m));
}