二分法,今天周末并且下雪了,我要回宿舍喝奶茶

# 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
#
# 
# @param x int整型 
# @return int整型
#
class Solution:
    def mysqrt(self , x: int) -> int:
        # write code here
        x1 = 0
        x2 = x
        x0 = (x1+x2)//2
        Re = x0
        if x1**2 == x:
            Re = x1
        if x2**2 == x:
            Re = x2
        else :
            while (((x0**2-x) <=0 and ((x0+1)**2-x)>0)==False):
                x0 =(x1+x2)//2
                if (x0**2-x) < 0:
                    x1 = x0
                    Re = x0
                if (x0**2-x)>0:
                    x2 = x0
                if (x0**2-x) == 0:
                    Re=x0
        return Re