367. Valid Perfect Square

来源:互联网 发布:大富翁3.4棋牌源码 编辑:程序博客网 时间:2024/04/30 13:05
class Solution {public:    bool isPerfectSquare(int num) {        int i=1;        while(num>0)        {            num-=i;            i+=2;        }        return num==0;    }};
1 0