solution 1 : same as #167
bool judgeSequareSum(int c){
for(int i=0, j=round(sqrt(c));i<=j; i++){
for(; i<j;j--){
if(i*i + j*j <= c) break;
}
if(i*i + j*j == c) return true;
}
return false;
}
solution 2: b = round(sqrt( c) - a) , 循环a 查找是否存在b
bool judgeSquareSum(int c) {
for(long long i= 0 ;i* i <= c; i++){
long long f= round(sqrt(c- i*i));
if(f*f == (c-i*i)) return true;
}
return false;
}