题目:
题解:
java
class Solution {
public boolean checkPerfectNumber(int num) {
if (num == 1) {
return false;
}
int sum = 1;
for (int d = 2; d * d <= num; ++d) {
if (num % d == 0) {
sum += d;
if (d * d < num) {
sum += num / d;
}
}
}
return sum == num;
}
}