#include "Stdio.h"
#include "Conio.h"
int main(void)
{
int i,j,k;/*loop variables*/
int m; /*the basic 3 bits integrates*/
int compare(int,int);
for(i=1;i<=3;i++)
{
for(j=1;j<=9;j++)
{
if(i==j)
continue;
else
{
for(k=1;k<=9;k++)
{
if(k==i||k==j)
continue;
else
{
m=100*i+10*j+k;
if(m<=333)
{
if(compare(m,2*m)&&compare(m,3*m)&&compare(2*m,3*m))
printf("%d %d %d\n",m,2*m,3*m);
}/*make a range for m(no bigger than 333)*/
}/*the third bit are not same as the first and second*/
}/*the third bit*/
}/*the first and second bit are not same*/
}/*the second bit*/
}/*the first bit*/
getch();
return 0;
}
int compare(int y,int z)
{
int multm[2][3];/*three 3 bits integrates*/
int x,w;
int n=100;
int flag;
for(x=0;x<=2;x++)
{
multm[0][x]=y/n;
multm[1][x]=z/n;
y=y%n;
z=z%n;
n/=10;
} /*get the three bit of m and 2m and 3m while putting them in the multm[][] 2D number array*/
for(x=0;x<=2;x++)
{
for(w=0;w<=2;w++)
{
if(multm[0][x]==multm[1][w]||multm[0][x]==0||multm[1][w]==0)/*2m and 3m may have 0 as bit*/
{
flag=0;
break;
}/*if there are bits same then jump out loop*/
else
flag=1;
}/*judge two integrates bits same or not step1*/
if(flag==0)
break;
else
continue;
}/*judge two integrates's bits same or not step2*/
if(flag==0)
return 0;
else
return 1;
}/*function compare*/