STRONG NUMBER

5

1 votes
Problem
 

Problem Statement:

A number is called strong number if sum of the factorial of its digit is equal to number itself.

For example: 145

since

1! + 4! + 5! = 1 + 24 + 120 = 145

So, 145 is a Strong number. Now given a positive number and you have to find the number is strong number or not .

Input:

An integer T (1<=T<=1000) denoting the number of test cases followed by T lines. Each next line containing a single integer N (0 <= N<= 1018)

Output:

For each case output string “YES” if given number is strong number and “NO” otherwise in next line.

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?