递归-放苹果

//递归-放苹果
#include<stdio.h>
int count(int x,int y)
{
	if(y==1||x==0) return 1;
	if(x<y) return count(x,x);
	return count(x,y-1)+count(x-y,y);
}
int main()
{
	int t,m,n,i;
	scanf("%d",&t);
	for(i=0;i<t;i++)
	{
		scanf("%d%d",&m,&n);
		printf("%d\n",count(m,n));
	}
	return 0;
}

posted on 2015-07-22 23:46  _noname  阅读(106)  评论(0编辑  收藏  举报