在函数递归要用过程中 不清楚放苹果这道问题的递归返回值是怎样的,请以5个苹果3个盘子为例将返回过程表达清楚,不要代码,要返回过程
具体的题目是什么,放的规则?
这道题具体是啥?
#include <bits/stdc++.h>
using namespace std;
int f(int m,int n)
{
if(m==0||n==1)
{
return 1;
}
if(n>m)
{
return f(m,m);
}
else
{
return f(m,n-1)+f(m-n,n);
}
}
int main()
{
int m,n,c;
cin>>c;
while(c--)
{
cin>>m>>n;
cout<<f(m,n);
}
return 0;
}
您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!