题目描述
A Krishnamurthy number is a number whose sum of the factorial of digits is equal to the number itself. Given a number N as input. Print "YES" if it's a Krishnamurthy Number, else Print "NO".
Example 1:
Input:
N = 145
Output:
YES
Explanation:
1! + 4! + 5! = 145 So, 145 is a
Krishnamurthy Number and therefore
the Output "YES".
Example 2:
Input:
N = 14
Output:
NO
Explanation:
1! + 4! = 25 So, 14 isn't a
Krishnamurthy Number and therefore
the Output "NO".
Your Task:
You don't need to read input or print anything. Your task is to complete the function isKrishnamurthy() which takes an Integer N as input and returns the answer.
Expected Time Complexity: O(|N|)
Expected Auxiliary Space: O(1)
Constraints:
1 <= N <= 10^{8}
输入格式
见题面
输出格式
见题面