题解 | #表达式求值#
表达式求值
http://www.nowcoder.com/practice/c215ba61c8b1443b996351df929dc4d4
import javax.script.*;
public class Solution {
public int solve (String s) throws Exception {
return (Integer) new ScriptEngineManager().getEngineByName("js").eval(s);
}
}
Java调用js引擎,利用js的eval函数,一行秒