回复:(fyi1106)穷举,从1到10000逐个试。这个是没有...
能写个源程序吗?谢谢了.
觉得这个挺有意思的,写了一下.
int main()
{
for(int i=10; i<10000; i++)
{
int a = i%10;
if(a==0) continue;
int b = i/10;
if(b<10)
if(a==b)
{
cout<<i<<" "; continue;
}
int a_a = b%10;
int b_b = b/10;
if(b_b<10)
if(a==b_b)
{
cout<<i<<" "; continue;
}
int a_a_a = b_b%10;
int b_b_b = b_b/10;
if(b_b_b<10)
if((a==b_b_b)&&(a_a==a_a_a))
{
cout<<i<<" "; continue;
}
}
cout<<endl;
return 0;
}