华为笔试题第二题总是提示通过0%
dota那道题,总是提示0%。求大佬看看问题出在哪里
import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(), m = in.nextInt(); long[] dp = new long[m + 1]; Arrays.fill(dp, 1); dp[m] = 1; for (int i = n - 1; i > 0; i--) { for (int j = m - 1; j >= 0; j--) { dp[j] += dp[j + 1]; dp[j] %= 1000000007; } } System.out.println(dp[0]==Integer.MAX_VALUE?-1:dp[0]); } }