@[cuitxf](/user/253951) 那个题解应该用的是搜索,你用的应该是递推
by HearTheWindSing @ 2020-02-21 13:50:24
是的,题目有说
by nao_nao @ 2020-02-21 13:50:48
```cpp
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#pragma warning(disable:4996)
int a, b, cnt, n, num[17][17];
void dfs(int x, int y)
{
if (x == a && y == b)
{
cnt++;
return;
}
if (x + 1 >= 1 && x + 1 <= a && y >= 1 && y <= b && num[x + 1][y] == 0)
{
dfs(x + 1, y);
}
if (x >= 1 && x <= a && y + 1 >= 1 && y + 1 <= b && num[x][y + 1] == 0)
{
dfs(x, y + 1);
}
}
int main()
{
int c, d;
scanf("%d%d%d", &a, &b, &n);
for (int i = 0; i < n; i++)
{
scanf("%d%d", &c, &d);
num[c][d] = 1;
}
dfs(1, 1);
printf("%d", cnt);
return 0;
}
```
@[wangyxhaha](/user/177072) 我用的dfs没标记过了,这是代码
by cuitxf @ 2020-02-21 13:55:20
这个属于递归啊
by Ybxnlrx @ 2021-08-03 13:38:49