| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
AC#include <stdio.h>
int apple(int M,int N)
{
if(M<0)
return 0;
if(M==0 || N==1)
return 1;
return apple(M-N,N)+apple(M,N-1);
}
int main()
{
int i,n,M[20],N[20],K[20];
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d%d",&M[i],&N[i]);
K[i]=apple(M[i],N[i]);
}
for(i=0;i<n;i++)
{
printf("%d\n",K[i]);
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator