我求出来了3组解
0010110011
0111010000
1011010000
没验证 ,你自己去验证,呵呵
public class Main {
/**
* @param args
*/
private static int score = 10;
private static int[] test = new int[10];
public static void main(String[] args) {
// TODO Auto-generated method stub
for(int a =0 ; a <= 1; a++){
for(int b =0 ; b <= 1; b++){
for(int c =0 ; c <= 1; c++){
for(int d =0 ; d <= 1; d++){
for(int e =0 ; e <= 1; e++){
for(int f =0 ; f <= 1; f++){
for(int g =0 ; g <= 1; g++){
for(int h =0 ; h <= 1; h++){
for(int i =0 ; i <= 1; i++){
for(int j =0 ; j <= 1; j++){
test[0] = a;
test[1] = b;
test[2] = c;
test[3] = d;
test[4] = e;
test[5] = f;
test[6] = g;
test[7] = h;
test[8] = i;
test[9] = j;
fun();
if(score == 100){
for(int k =0 ;k< 10 ;k++)
System.out.print(test[k]);
System.out.print("\n");
}
score = 10;
}
}
}
}
}
}
}
}
}
}
}
private static void fun(){
for(int i=0 ;i < 10 ;i++){
if(test[i] == 1){
score *= 2;
}else{
score -= (i+1);
}
}
}
}
这个貌似是蓝桥杯的初赛题啊。
public class Test {
public static void main(String args[]){
for(int i=1024;i<2048;i++){
int d=10;
String a=Integer.toBinaryString(i);
String e=a.substring(1);
for(int m=1;m<11;m++){
String b=a.substring(1, 2);
a=a.substring(1);
int c=Integer.parseInt(b);
if(c==0){
d=d-m;
}
if(c==1){
d=d*2;
}
}
if(d==100){
System.out.println(e);
}
}
}
}
先不说JAVA了,就先理清它就够思考的了。