蓝桥杯——走方格


 

 

 题解:

#include<bits/stdc++.h>
using namespace std;
int f[40][40];
int n,m;
int main()
{
    cin>>n>>m;
    f[0][1]=1;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(i%2==0&&j%2==0) f[i][j]=0;
            else
            {
                f[i][j]=f[i-1][j]+f[i][j-1];
            }
        }
    }
    cout<<f[n][m]<<endl;
}
posted @ 2023-04-06 20:36  小花护符  阅读(9)  评论(0编辑  收藏  举报