解题思路:
注意事项:
参考代码:
#include<iostream>
using namespace std;
long long int soluteMethon(int N,int K,int totalMoney){
if( N<0 || K<0 || totalMoney<0)
return 0;
if( N == 0 || K ==0)
return 1;
if( totalMoney <=0){
return soluteMethon(N-1,K,totalMoney+1);
}
else
return soluteMethon(N-1,K,totalMoney+1) + soluteMethon(N,K-1,totalMoney-1);
}
int main(){
int M,N,K;
cin>>M>>N>>K;
int maxCount = M>N?M:N;
long long int nCount = 1;
long long int kCount = 1;
if( N<K)
cout<<0<<endl;
else{
for(int i=1;i<= maxCount;i++){
if( i<=N)
nCount *= i;
if( i<=K)
kCount *= i;
}
cout<<soluteMethon(N,K,0)*nCount*kCount<<endl;
}
return 0;
}
0.0分
1 人评分