代码如下:
#include <bits/stdc++.h>
using namespace std;
int main()
{
int one, two, three;
for (int a = 1; a <= 9; a++)
{
for (int b = 1; b <= 9; b++)
{
if (a == b)
{
continue;
}
for (int c = 1; c <= 9; c++)
{
if (b == c || a == c)
{
continue;
}
one = a * 100 + b * 10 + c;
for (int d = 1; d <= 9; d++)
{
if (c == d || b == d || a == d)
{
continue;
}
for (int e = 1; e <= 9; e++)
{
if (d == e || c == e || b == e || a == e)
{
continue;
}
for (int f = 1; f <= 9; f++)
{
if (e == f || d == f || c == f || b == f || a == f)
{
continue;
}
two = d * 100 + e * 10 + f;
for (int g = 1; g <= 9; g++)
{
if (f == g || e == g || d == g || c == g || b == g || a == g)
{
continue;
}
for (int h = 1; h <= 9; h++)
{
if (g == h || f == h || e == h || d == h || c == h || b == h || a == h)
{
continue;
}
for (int i = 1; i <= 9; i++)
{
if (h == i || g == i || f == i || e == i || d == i || c == i || b == i || a == i)
{
continue;
}
three = g * 100 + h * 10 + i;
if (one * 3 == two * 2 && two * 2 == three)
{
cout << one << ' ' << two << ' ' << three << endl;
}
}
}
}
}
}
}
}
}
}
return 0;
}
谢大神们指点!!!谢谢!!!