题目链接:https://leetcode-cn.com/problems/valid-perfect-square/
题目如下:
class Solution { public: bool isPerfectSquare(int num) { int low=1,high=num,mid; while(low<high){ mid=(low+1ll+high)>>1; if(mid<=num/mid) low=mid; else high=mid-1; } if(high*high==num) return true; else return false; } };