All Submissions


A numbwer is called Factorian if it is equal to some of factorial of it's digits.
For example 145 is a factorian because 145=1! + 4! + 5!=1+24+120=145.

You task is to check if a number is factorian or not.

Input
First Line Contains T denoting the number of test cases that follow.
Next T lines contains a positive Integer.

Output
For every Input Integer,
If it an factorian Number , print FACTORIAN
else print NOT FACTORIAN

constraints
T<=1000
Every numnber is between 1 and 1000.

Sample Input
2
145
146

Sample output
FACTORIAN
NOT FACTORIAN

Problem Setter : Arjun Singh Bhatia


Languages: Brain,C,C++,Java,Pascal,Perl,PHP,Python,Ruby,Text

Time Limit: 3 Second(s)
Score: 0 Point(s)
Input File Limit: 50000 Bytes

Submit

Login to post clarification.

No Clarifications.

Contest

Mode Judge

Passive

Online

Overall Rankings

RankNameScore
1xyz0
2Ams0
3TIP0
4team420
5xyzz0
6asdasdasd0
7abcd0
8khankhan0
9Gabriel0
10gigel0