题目要求输出格式为一个非负整数,为答案mod100003后的结果,所以每次循环应该将 a[i][j] mod 100003;
代码实现
#include<stdio.h>int n, m, x, y;int a[1003][1003]={0}, b[1003][1003]={0};intmain(){int i, j;scanf("%d%d",&n,&m);for(i=1;i<=m;i++){scanf("%d%d",&x,&y);
b[x][y]=1;}
a[1][1]=1;for(i=1;i<=n;i++)for(j=1;j<=n;j++){if(b[i][j]==1)
a[i][j]=0;else
a[i][j]+=a[i-1][j]+a[i][j-1];
a[i][j]=a[i][j]%100003;}printf("%d", a[n][n]);return0;}