Perfect Number
Submissions: 4239   Accuracy:

27.07%

  Difficulty: School   Marks: 0
*School Problem's Submission isn't counted in score!
     

Check if  a given number is perfect or not. A number is perfect if sum of factorial of its digit is equal to the given number. For example 145 is a Perfect Number because 1! + 4! + 5! = 145

Input:
The first line of input contains an integer T denoting the number of test cases. For each test case there will be single line which contains an integer N.

Output:
Corresponding to each test case, in a new line, print "Perfect " if it follow above condition else print "Not Perfect"  without quotes.

Constraints:
1 <= T <=  50
1 <= N <= 104
Example:
Input:
2
23
145

Output:
Not Perfect
Perfect

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

Contributor: karan kumar
Author: karanshrm44


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

to report an issue on this page.