注意数据范围!!!
二分重拳出击中等简单题!!!
class Solution {
public boolean judgeSquareSum(int c) {
if(c == 0) return true;
int i = 0, j = (int)Math.sqrt(c);
while(i <= j){
long tmp = (long)i * i + (long) j * j;
if(tmp == (long)c) return true;
else if(tmp > (long) c) j --;
else i ++;
}
return false;
}
}