Find X
Submissions: 613   Accuracy:

12.76%

  Difficulty: Easy   Marks: 2

Given a value N. Find number of values X ( 1<=X<=N) which satisfy the equation.
X + S(F(X)) + S(F(S(F(X))) = N
where F(X) is a function which returns the product of digits of X, and S(X) is a function which returns sum of digits of X.

Input:

First line of test case contains an integer T, denoting number of the test cases. Each line of the test case contains an integer N.

Output:

For each of the test case print the answer in separate line.

Constraints:

1<=T<=10^4
1<=N<=10^5
Example:

Input:

1
6

Output:

1

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

Author: ShivamKD


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.