日期:2014-05-20 浏览次数:20834 次
private static void r(int i, String pre) {
for (String m : new String[]{"+", "-", ""}) {
if (i == 9) {
ScriptEngineManager sem = new ScriptEngineManager();
ScriptEngine jsEngine = sem.getEngineByName("JavaScript");
try {
String rs = jsEngine.eval(pre + m + i).toString();
if (rs.equals("110.0")) {
System.out.println(pre + m + i + "=110");
}
} catch (ScriptException e) {
e.printStackTrace(System.err);
}
} else {
r(i + 1, pre + m + i);
}
}
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
r(2, "1");
}