public class Test1 {
static boolean digitEqual(int n) {
int a = n % 10;
int b = n / 10 % 10;
int c = n / 100;
if (a == b || a == c || b == c)
return true;
return false;
}
static int[] digit(int n) {
return new int[] { n % 10, n / 10 % 10, n / 100 };
}
public static void main(String[] args) {
boolean[] d = new boolean[10];
Here:
for (int i = 123; i <= 329; i++)
if (!digitEqual(i) && !digitEqual(2 * i) && !digitEqual(3 * i))
{
for(int j=0;j
for(int j:digit(i))
d[j]=true;
for(int j:digit(2*i))
d[j]=true;
for(int j:digit(3*i))
d[j]=true;
for(int j=1;j
continue Here;
System.out.println(i + " " + 2 * i + " " + 3 * i);
return;
}
}
}
一楼正解