题目:
题解:
Go
func checkPerfectNumber(num int) bool {
if num == 1 {
return false
}
sum := 1
for d := 2; d*d <= num; d++ {
if num%d == 0 {
sum += d
if d*d < num {
sum += num / d
}
}
}
return sum == num
}