【leetcode】x的平方根

int mySqrt(int x){

    unsigned int i = 0;
    while(i * i < x)
        i++;
    if (i * i == x)
        return i;
    return --i;
}

 

posted @ 2020-08-14 14:53  温暖了寂寞  阅读(100)  评论(0编辑  收藏  举报