#include "stdio.h"
int f(int m,int n)
{
if(m==0||n==0)return 1;
return f(m-1,n)+f(m,n-1);/* f(m-1,n)是第一个空被A占据时的排列种数,f(m,n-1)是第一个空被B占据时的排列种数*/
}
main()
{
int x,y,c;
printf("Please input number of A and B:");
scanf("%d%d",&x,&y);
c=f(x,y);
printf("The array has %d methods.",c);
}
int f(int m,int n)
{
if(m==0||n==0)return 1;
return f(m-1,n)+f(m,n-1);/* f(m-1,n)是第一个空被A占据时的排列种数,f(m,n-1)是第一个空被B占据时的排列种数*/
}
main()
{
int x,y,c;
printf("Please input number of A and B:");
scanf("%d%d",&x,&y);
c=f(x,y);
printf("The array has %d methods.",c);
}