有没有好心的老哥看看第二题问题出在哪,dp只过了33
package bishi.xiaohongshu;
import java.util.Arrays;
import java.util.Scanner;
/**
* @Author laimouren
* @Date 2022/3/13 20:22
*/
public class Main22 {
static boolean[][] help;
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int M = scanner.nextInt();
int N = scanner.nextInt();
int K = scanner.nextInt();
if (M == 1 || N == 1){
System.out.println(0);
}
help = new boolean[M][N];
long dp[][] = new long[M][N];
//Arrays.fill(dp,0);
for (int i = 0; i < K; i++) {
help[scanner.nextInt()-1][scanner.nextInt()-1] = true;
}
for (int i = 0; i < dp.length; i++) {
dp[i][0] = 1;
}
for (int j = 0;j < dp[0].length;j++){
dp[0][j] = 1;
}
for (int i = 1; i < dp.length; i++) {
for (int j = 1; j < dp[i].length; j++) {
dp[i][j] = 0;
//有石头
if(!help[i][j]){
dp[i][j] = (long) ((dp[i-1][j] + dp[i][j-1])% (10e9+7));
}
}
}
System.out.println(dp[M-1][N-1]);
}
}
#小红书##笔经#