eolymp
bolt
Try our new interface for solving problems
Problems

Digits

Digits

A positive integer which is equal to \textbf{C^n}, where \textbf{С} = \textbf{1}..\textbf{9} contains at least \textbf{K} numbers \textbf{C}. For given numbers \textbf{C} and \textbf{K} find the smallest value of \textbf{N}. \InputFile In the input file contains two numbers \textbf{С} and \textbf{K}, \textbf{K} ≤ \textbf{500}. \OutputFile One number \textbf{N}.
Time limit 1 second
Memory limit 64 MiB
Input example #1
9 2
Output example #1
5

Example description: 9^5=59049 – set of 2 digit 9.

Author Zhukovsky S.S.
Source Stage III All-Ukrainian School Olympiad 2010-2011, Round 2, Zhytomyr