展开全部
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class PingFang {
public static void main(String[] args) {
PingFang p = new PingFang();
String s = "";
for(int i =100;i<1000;i++) {
if(p.isnotcontian0(i)){
if (p.isnotcf(i)) {
if(p.isPinfang(i)) {
s+= i+",";
}else {
//System.out.println("因为"+i+"不是平62616964757a686964616fe4b893e5b19e31333332623931方数,被删除!");
}
}else {
//System.out.println("因为"+i+"含有重复数字,被删除!");
}
}else {
//System.out.println("因为"+i+"含有0,被删除!");
}
}
String [] ss =s.split(",");
int count = ss.length;
for(int i =0;i
for(int j = i+1;j
for(int k = i+2;k
List list = new ArrayList();
String ss_s = "";
ss_s = ss[i]+ss[j]+ss[k];
char[] cc= ss_s.toCharArray();
for(int y =0;y
String as = String.valueOf(cc[y]);
list.add(Integer.parseInt(as));
}
Collections.sort(list);
String s_result = "";
for(int x = 0;x
s_result += list.get(x).toString();
}
if (s_result.equals("123456789")) {
System.out.println("分组为:"+ss[i]+","+ss[j]+"和"+ss[k]);
}
}
}
}
}
public boolean isnotcontian0(int n) {
String s = "" + n;
if (s.contains("0")) {
return false;
} else {
return true;
}
}
public boolean isnotcf(int n) {
boolean b = true;
String s = ""+n;
char[] c = s.toCharArray();
for(int i=0;i
for(int j= i+1;j
if(c[i] == c[j]) {
b = false;
}
}
}
return b;
}
public boolean isPinfang(int n) {
boolean b = false;
double x = Math.sqrt(n);
int a = (int) x;
if(a*a == n) {
b= true;
}
return b;
}
}