#include<stdio.h>
int temp1,temp2,temp3,a,b,c,d,e,f,g,h,i;
int check1()
{
if(c==a||c==b)
return 0;
return 1;
}
int check2()
{
if(d==a||d==b||d==c||e==a||e==b||e==c||f==a||f==b||f==c||d==e||d==f||e==f)
return 0;
return 1;
}
int check3()
{
if(g==a||g==b||g==c||g==d||g==e||g==f||g==h||g==i||h==a||h==b||h==c||h==d||h==e||h==f||h==i||i==a||i==b||i==c||i==d||i==e||i==f)
return 0;
return 1;
}
int main()
{
for(a=1;a<=3;a++)
for(b=1;b<=9;b++)
{
if(a!=b)
{
for(c=1;c<=9;c++)
{
if(check1())
{
temp1=a*100+b*10+c;
temp2=2*temp1;
d=temp2/100;
f=temp2%10;
e=(temp2-d*100-f)/10;
if(check2()&&d&&e&&f)
{
temp3=3*temp1;
g=temp3/100;
i=temp3%10;
h=(temp3-g*100-i)/10;
if(check3()&&g&&h&&i&&temp3<=987)
printf("%d %d %d\n",temp1,temp2,temp3); // 运用了一下输出中间变量来检查出错的地方
}
}
}
}
}
return 0;
}
int temp1,temp2,temp3,a,b,c,d,e,f,g,h,i;
int check1()
{
if(c==a||c==b)
return 0;
return 1;
}
int check2()
{
if(d==a||d==b||d==c||e==a||e==b||e==c||f==a||f==b||f==c||d==e||d==f||e==f)
return 0;
return 1;
}
int check3()
{
if(g==a||g==b||g==c||g==d||g==e||g==f||g==h||g==i||h==a||h==b||h==c||h==d||h==e||h==f||h==i||i==a||i==b||i==c||i==d||i==e||i==f)
return 0;
return 1;
}
int main()
{
for(a=1;a<=3;a++)
for(b=1;b<=9;b++)
{
if(a!=b)
{
for(c=1;c<=9;c++)
{
if(check1())
{
temp1=a*100+b*10+c;
temp2=2*temp1;
d=temp2/100;
f=temp2%10;
e=(temp2-d*100-f)/10;
if(check2()&&d&&e&&f)
{
temp3=3*temp1;
g=temp3/100;
i=temp3%10;
h=(temp3-g*100-i)/10;
if(check3()&&g&&h&&i&&temp3<=987)
printf("%d %d %d\n",temp1,temp2,temp3); // 运用了一下输出中间变量来检查出错的地方
}
}
}
}
}
return 0;
}