60分求条
查看原帖
60分求条
1385791
fushuoting楼主2024/11/10 22:04
#include<bits/stdc++.h>
using namespace std;
int a[21][21];
bool b[21][21];
int main()
{
    int n,m,x,y;
    cin>>n>>m>>x>>y;
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=m;j++)
        {
            b[i][j]=true;
        }
    }
    b[x][y]=false;
    b[x+2][y+1]=false;
    b[x+1][y+2]=false;
    b[x-1][y+2]=false;
    b[x-2][y+1]=false;
    b[x-2][y-1]=false;
    b[x-1][y-2]=false;
    b[x+1][y-2]=false;
    b[x+2][y-1]=false;
    for(int i=0;i<=n;i++)
    {
        for(int j=0;j<=m;j++)
        {
            if(i==0||j==0)
            {
                if(b[i][j]!=false)
                {
                    a[i][j]=1;
                }
            }
        }
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(b[i][j]!=false)
            {
                a[i][j]=a[i-1][j]+a[i][j-1];
            }
        }
    }
    cout<<a[n][m];
    return 0;
}

2024/11/10 22:04
加载中...