题解 | #走方格的方案数#
走方格的方案数
https://www.nowcoder.com/practice/e2a22f0305eb4f2f9846e7d644dba09b
#include<iostream>
using namespace std;
static int wcount = 0;
static int n,m;
void travel(const int& i,const int& j)
{
if(i < n)
travel(i+1,j);
if(j < m)
travel(i, j+1);
if(i == n && j == m)
{
wcount++;
return;
}
}
int main()
{
cin>>n>>m;
travel(0,0);
cout<<wcount;
}