解题思路:
注意事项:
参考代码:
import java.util.Scanner;
public class DGdemo1
{
public static class Main
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
long n = sc.nextLong();
int k = sc.nextInt();
System.out.print(quantify(n,k));
}
public static long quantify(long n,int k)
{
if(n<k||n==0)
return 0;
else if(n==1||k==1)
return 1;
return quantify(n-1,k-1)+k*quantify(n-1,k);
//假设有个特殊的元素①(不在n-1子集中)直接放入第k个篮子;②(在n-1子集中)放入k个篮子,则有k种方法放入
}
}
}
0.0分
0 人评分