40分求助!
查看原帖
40分求助!
547002
hang09楼主2022/9/4 12:51
#include <iostream>
#include <cstring>
using namespace std;

int n,m;
int a[1010][1010];
int b[1010][1010];
int main()
{
    cin >> n >> m;
    memset(b,0,sizeof(b));
    memset(a,0,sizeof(a));
    a[1][1] = 1;
    for(int i = 1; i <= m; i++)
    {
        int x,y;
        cin >> x >> y;
        b[x][y] = -1;
    }
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n; j++)
        {
            
            if((i == 1 && j == 1) || b[i][j] == -1)continue;
            else a[i][j] = (a[i - 1][j] % 10003 + a[i][j - 1] % 10003);
        }
    }
    cout << a[n][n];
    return 0;
}
2022/9/4 12:51
加载中...