日期:2014-05-18 浏览次数:20694 次
/**
*
*/
package com.bch;
import java.util.HashSet;
import java.util.Set;
/**
* @author Administrator
*
*/
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
Set<Character> set = new HashSet<Character>();
for (int i = 123; i <= 329; i++) {
char[] str = (0 + String.valueOf(i) + String.valueOf(i * 2) + String
.valueOf(i * 3)).toCharArray();
for (int j = 0; j < str.length; j++) {
// set.clear();
set.add(str[j]);
}
// System.out.println(set.toString());
if (set.toArray().length == 10) {
System.out.println(String.valueOf(i) + ","
+ String.valueOf(i * 2) + "," + String.valueOf(i * 3));
set.clear();
} else {
set.clear();
}
}
}
}
List<Integer> results = new ArrayList<Integer>();
Set<Integer> temp = new HashSet<Integer>();
int[] a = new int[9];
for(int i=160;i<987/3;i++){
a[0] = i/100;
a[1]=(i-a[0]*100)/10;
a[2] = i-a[0]*100-a[1]*10;
a[3] = 2*i/100;
a[4]=(2*i-a[3]*100)/10;
a[5] = 2*i-a[3]*100-a[4]*10;
a[6] = 3*i/100;
a[7]=(3*i-a[6]*100)/10;
a[8] = 3*i-a[6]*100-a[7]*10;
temp.clear();
for(int x=0;x<9;x++){
if(a[x]==0) break;
temp.add(a[x]);
}
if(temp.size()==9)results.add(i);
}
System.out.println(results.size());
System.out.println(results);