leetcode507】的更多相关文章

We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itself. Now, given an integer n, write a function that returns true when it is a perfect number and false when it is not. Example: Input:…
public class Solution { public bool CheckPerfectNumber(int num) { ) { return false; } ; ; i <= num / ; i++) { ) { var j = num / i; if (i <= j) { sum += i; sum += num / i; if (sum > num) { break; } } else { break; } } } if (sum == num) { return tr…