P16120 [GeeksforGeeks] Weird number0933
普及-
题目描述

Given a number N check whether it is wierd or not. A number is weird if the sum of the proper divisors (divisors including 1 but not itself) of the number is greater than the number, but no subset of those divisors sums to the number itself.

Example 1:
Input: N = 70
Output: 1
Explanation: The smallest weird number
is 70. Its proper divisors are 1, 2, 5,
7, 10, 14, and 35; these sum to 74, but
no subset of these sums to 70.
Example 2:
Input: N = 12
Output: 0
Explanation: The number 12, for example,
is not weird, because the proper divisors
of 12 are 1, 2, 3, 4, and 6, sum of
divisors is 16; but there is a subset
{2, 4, 6} with sum 12, i.e., 2+4+6 = 12.

Your Task:
You don't need to read or print anything. Your task is to complete the function is_weird() which takes n as input parameter and returns 1 if the number is weird number otherwise returns 0.

Expected Time Complexity: O(N)
Expected Space Complexity: O(1)

Constraints:
1 <= N <= 10000

输入格式

见题面

输出格式

见题面

样例输入
N = 70
样例输出
1