class Solution {
public boolean judgeSquareSum(int c) {
for (int i = 0; i <=(int)Math.sqrt(c); i++) {
{ int sub=c-i*i;
if(Math.abs(Math.sqrt(sub)-(int)Math.sqrt(sub))<0.00001) return true;
}
}
return false;
}
}
Leetcode 633. 平方数之和
最新推荐文章于 2021-04-28 21:27:36 发布