问题: 000001 - 999999 的6位序号里面按一定的规律找出“靓号” 3个数字一样,另3个数相同。 如: 808080 。 输出结果没有重复
算法:先在0到9中选两个数字,然后给0选出三个位置。
程序:
#include <iostream>
using namespace std;
int
main()
{
for(int i=0; i<10; i++)
for(int j=i+1; j<10; j++)
for(int r=0; r<4; r++)
for(int s=r+1;s<5; s++)
for(int t=s+1; t<6; t++){
for(int k=0; k<6; k++){
if(k==r || k==s || k==t)
cout << i;
else
cout << j;
}
cout << endl;
}
return 0;
}