Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

AC

Posted by 201165148 at 2012-06-20 14:16:53 on Problem 1664
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator