111

Gooooogle  •  7个月前


#include<bits/stdc++.h>
using namespace std;
int fun(int m, int n) {//m个苹果放在n个盘子中共有几种方法
    if(m==0 || n==1)
        return 1;
    if(n>m)
        return fun(m,m);
    else
        return fun(m,n-1)+fun(m-n,n);
}
int main()
{
    int m,n,t;
	cin>>t;
	while(t--)
	{
	 cin>>m>>n;
   	 cout<<fun(m,n);
	}
    return  0;
}



评论:

请先登录,才能进行评论