time limit per test: 0.25
memory limit per test: 4096
Let us call P(n) - the product of all digits of number n (in decimal notation).
For example, P(1243)=1*2*4*3=24; P(198501243)=0.
Let us call n to be a good number, if (p(n)<>0) and (n mod P(n)=0).
Let us call n to be a perfect number, if both n and n+1 are good numbers.
You are to write a program, which, given the number K, counts all such
numbers n that n is perfect and n contains exactly K digits in decimal notation.
Only one number K (1<=K<=1000000) is written in input.
Output the total number of perfect k-digit numbers.
|Author:||All-Russian mathematical olympiad jury
|Resource:||District mathematical olympiad, 8th form
|Server time: 2017-11-21 05:20:23||Online Contester Team © 2002 - 2016. All rights reserved.|