Weird Number
Submissions: 927   Accuracy:

22.52%

  Difficulty: Basic   Marks: 1

Write a program to check whether a number is wierd or not. A weird 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:

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. 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.

Input:

First line contains number of test cases T. Then following T lines contains an integer N.


Output:

Output "Weird" if given number is strong else "Not Weird" .


Constraints:

1<=T<=100
2<=N<=10000


Example:

Input:
2
5
70

Output:
Not Weird
Weird

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Sanjai Verma
Author: dipjal1996


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.