#include <stdlib.h>
int Combination(int sumKindsNum,int selectKindsNum)
int main(int argc, char *argv[])
{
printf("%d\n",Combination(5,4))
system("PAUSE")
return 0
}
int Combination(int sumKindsNum,int selectKindsNum)
{
int tempVal1 = 1
int tempVal2 = 1
int i = sumKindsNum - selectKindsNum + 1
int j = 1
if ( sumKindsNum <selectKindsNum )
{
return 0
}
for( ii <sumKindsNum + 1i++ )
{
tempVal1 *= i
}
for ( jj <selectKindsNum + 1j++ )
{
tempVal2 *= j
}
return tempVal1 / tempVal2
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)