import java.util.*; public class Solution { /** * * @param x int整型 * @return int整型 */ public int mysqrt (int x) { // write code here if (x == 0) { return 0; } int ans = (int) Math.exp(Math.log(x) * 0.5); return (ans + 1) * (ans + 1) <= x ? ans + 1 : ans; } }