You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
422 B
24 lines
422 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
int m, n;
|
|
int dx[] = {0, 1};
|
|
int dy[] = {1, 0};
|
|
int cnt;
|
|
void dfs(int x, int y) {
|
|
if (x == m && y == n) {
|
|
cnt++;
|
|
return;
|
|
}
|
|
for (int i = 0; i < 2; i++) {
|
|
int tx = x + dx[i], ty = y + dy[i];
|
|
if (tx <= m && ty <= n)
|
|
dfs(tx, ty);
|
|
}
|
|
}
|
|
int main() {
|
|
cin >> m >> n;
|
|
dfs(1, 1);
|
|
printf("%d", cnt);
|
|
return 0;
|
|
} |