赞
踩
- public class Solution {
- public Boolean checkPerfectNumber(int num)
- {
- if (num < 2)
- return false;
- int sum = 1;
- for (int x = 2; x * x <= num; x++)
- {
- if (num % x == 0)
- {
- sum += x;
- sum += num / x;
- }
- }
-
- return sum == num;
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。