
117  ZOJ Monthly, June 2012  K
How many zeros are there in the end of s! if both s and s! are written in base k which is not necessarily to be 10? For general base, the digit order is 09,AZ,az(increasingly), for example F4 in base 46 is actually 694 in base 10,and f4 in base 46 is 1890 in base 10. InputThere are multiple cases(less than 10000). Each case is a line containing two integers s and k(0 ≤ s < 2^63, 2 ≤ k ≤ 62). OutputFor each case, output a single line containing exactly one integer in base 10 indicating the number of zeros in the end of s!. Sample Input101 2 12 7 Sample Output3 1 Author: ZHANG, Debing 