题目
满足abc小于或等于a b c d e小于或等于10的有序整数组(a,b,c,d,e)共有
提问时间:2020-12-16
答案
252个,可以用电脑编程解决,经计算知结果和C(5,10)的组合数相同,至于其他的m,n也与组合数C(n,m)相同
从10个数中选取5个数组成的所有排列为P(10,5),而其中5个数能构成的排列为P(5,5),
我们需要的只有一种,所以结果为P(10,5)/P(5,5)=C(10,5)=252
static int GetOrderIntegerCount(int[] arrTotal,int nIndex,int selectCount)
{
if (selectCount == 1)
{
return arrTotal.Length - nIndex;
}
int nCount = 0;
for (int i = nIndex; i < arrTotal.Length; i++)
{
nCount += GetOrderIntegerCount(arrTotal,i + 1,selectCount - 1);
}
return nCount;
}
Main函数中调用
int[] arrBuff = new int[] { 1,2,3,4,5,6,7,8,9,10 };
int nCount = GetOrderIntegerCount(arrBuff,0,10);
Console.WriteLine(nCount);
输出252
从10个数中选取5个数组成的所有排列为P(10,5),而其中5个数能构成的排列为P(5,5),
我们需要的只有一种,所以结果为P(10,5)/P(5,5)=C(10,5)=252
static int GetOrderIntegerCount(int[] arrTotal,int nIndex,int selectCount)
{
if (selectCount == 1)
{
return arrTotal.Length - nIndex;
}
int nCount = 0;
for (int i = nIndex; i < arrTotal.Length; i++)
{
nCount += GetOrderIntegerCount(arrTotal,i + 1,selectCount - 1);
}
return nCount;
}
Main函数中调用
int[] arrBuff = new int[] { 1,2,3,4,5,6,7,8,9,10 };
int nCount = GetOrderIntegerCount(arrBuff,0,10);
Console.WriteLine(nCount);
输出252
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
热门考点
- 1已知:x/y=1/2,求x^2+2xy+y^2/x^2-xy-2y^2的值
- 23千克水的八分之1和一千克水的八分之3一样重.这句话对么?
- 3植物体内的能量是从哪里获得的
- 43A+B+C+D=10 A+3B+C+D=12 A+B+3C+D=12 A+B+C+3D=8?问A/B/C/D/分别是多少
- 5这个书包是我妈妈给我的12岁的生日礼物 英文翻译
- 6在三角形ABC中,角A.B.C所对应的边分别为a.b.c,且满足acosB=bcosA=2ccosC (1)求角C的值; (2)若c=2.求三角
- 7真水无香阅读题回答正确的话追加50分不等
- 8400+400(1+X)+400(1+X)(1+X)=1324 1500(1+50%)(x/10)²=1500+500
- 9I love you more than the words can say
- 10一般过去时be动词的变化形式