//第一 package shangtang; import java.util.Scanner; public class Main1 {     public static void main(String[] args) {         Scanner sc = new Scanner(System.in);         String input = sc.nextLine();         String[] rowAndCol = input.split(" ");         if(rowAndCol.length != 2)             throw new RuntimeException("输入有误");         int row = Integer.valueOf(rowAndCol[0]);         int col = Integer.valueOf(rowAndCol[1]);         int[][] dp = new int[row][col];         for(int i=0;i<row;i++){             for(int j=0;j<col;j++){                 if(i==0 || j==0){                     dp[i][j] = 1;                 }else{                     dp[i][j] = dp[i-1][j]+dp[i][j-1];                 }             }         }         System.out.println(dp[row-1][col-1]);     } }
点赞 1

相关推荐

许愿ssp的咸鱼很不想泡池子:import python as pyhton
点赞 评论 收藏
分享
牛客网
牛客企业服务