怪物猎人配装器安卓版:6位数字组合问题???

来源:百度文库 编辑:高考问答 时间:2024/04/29 19:31:38
本人有六位数:667532 请问怎样才能组合出500个不同的排序!

先用7532排,有P4取4种排法,也就是4的阶乘=24种,然后把6插入到五个间隙中去,有两种情况:
1)两个6放在一起的:共有5种方法。
2)两个6分开放的:这样在前面排出来的数的5个间隙中可以选出两个来,共有C5取2=10种放法。

那么总的排出来的数只有24*(10+5)=360种。要完成你题目的要求似乎是不可能的。

现在我用C++编写一个程序来证明你题目的不可行性。并把这360个数在屏幕上打印出来。

#include <iostream>
using namespace std;
int main()
{
lo: unsigned b[6];
unsigned mark,count;
unsigned temp[800];
unsigned a[6]={6,6,7,5,3,2};
count=0;
mark=0;
for(int i=0;i<6;i++)
{
b[0]=a[i];
for(int j=0;j<6;j++)
{
if(j!=i)
{
b[1]=a[j];
for(int k=0;k<6;k++)
{
if(k!=i&&k!=j)
{
b[2]=a[k];
for(int l=0;l<6;l++)
{
if(l!=i&&l!=j&&l!=k)
{
b[3]=a[l];
for(int m=0;m<6;m++)
{
if(m!=i&&m!=j&&m!=k&&m!=l)
{
b[4]=a[m];
for(int n=0;n<6;n++)
{
if(n!=i&&n!=j&&n!=k&&n!=l&&n!=l&&n!=m)
{
b[5]=a[n];
temp[mark] =b[0]+b[1]*10+b[2]*100+b[3]*1000+b[4]*10000+b[5]*100000;
mark++;
count++;
}
}
}
}
}
}
}
}
}
}
}
for(int e=0;e<=mark;e++)
for(int f=e+1;f<=mark;f++)
{
if(temp[e]==temp[f])
{
count--;
temp[e]=0;
}
}
for(int n=0;n<mark;n++)
if(temp[n]!=0)
cout <<temp[n]<<" ";
cout << "count the resuft is " <<count << endl <<"If you want to shutdown the program ,Input 0;"<<endl<<"Input another number to run again:";
int u;
cin >> u;
if(u==0) return 0;
goto lo;
}

6的67532次幂等这样的数行不啊?