描述
aite的家乡盛产西瓜。这天,他打算把西瓜放在不同的房子里面,他要把M个西瓜放在N个房子里面(允许房间没有西瓜),你能发现有多少种分法吗?(如果有三个房间,(2,2,1)和(1,2,2)视为同一种分法。)
输入
第一行是一个整数t,代表有t组样例。
第二行有两个整数M和N代表有M个西瓜和N个房子。
输出
输出有多少种方法
输入样例
1
7 3
输出样例
8
描述
aite的家乡盛产西瓜。这天,他打算把西瓜放在不同的房子里面,他要把M个西瓜放在N个房子里面(允许房间没有西瓜),你能发现有多少种分法吗?(如果有三个房间,(2,2,1)和(1,2,2)视为同一种分法。)
输入
第一行是一个整数t,代表有t组样例。
第二行有两个整数M和N代表有M个西瓜和N个房子。
输出
输出有多少种方法
输入样例
1
7 3
输出样例
8
package com.result;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
int num=0;
int count=0;
int[][] demo=null;
int[] result=null;
Scanner scan=new Scanner(System.in);
if(scan.hasNextInt()){
num=scan.nextInt();
while(scan.hasNextInt()){
int house=scan.nextInt();
int thing=scan.nextInt();
demo[count][0]=house;
demo[count][1]=thing;
count++;
}
}
if(num!= demo.length){
System.exit(0);
}
for (int i = 0; i < demo.length; i++) {
result[i]=getDemo(demo[i][0], demo[i][1]);
}
for (int i = 0; i < result.length; i++) {
System.out.println("第"+i+"种案例有"+result[i]+"种分法");
}
}
public static int getDemo(int house,int thing){
//自己写逻辑,我数学不好,真不会算
return 1;
}
}