
简单粗暴
public class Solution {
/*
* @param : the given number
* @return: whether whether there‘re two integers
*/
public boolean checkSumOfSquareNumbers(int n) {
int max = (int)Math.sqrt(n) + 1;
for(int i=0; i<max; i++){
for(int j=0; j<max; j++){
if(i*i + j*j == n) return true;
}
}
return false;
}
};
题目来源: http://www.lintcode.com/zh-cn/problem/check-sum-of-square-numbers/
原文:http://www.cnblogs.com/cc11001100/p/7898182.html