Skip to content

Latest commit

 

History

History
16 lines (14 loc) · 282 Bytes

507.完美数.md

File metadata and controls

16 lines (14 loc) · 282 Bytes

方法一:数学

class Solution {
    public boolean checkPerfectNumber(int num) {
        int res = 0;
        for (int i = 1; i <= num / 2; i++) {
            if (num % i == 0) {
                res += i;
            }
        }
        return res == num;
    }
}