MetaOA #2
Count Powers of k in Readings
估计简单可在线判题
Given an array of positive integers and k, count the elements equal to a non-negative integer power of k, such as k⁰, k¹, k², and so on; duplicates are counted separately. The original site's answer to the first example is wrong, and this site has corrected it.
输入格式
The first line contains n k (1≤n≤100000, 2≤k≤10⁹), and the second line contains n positive integers (1..10⁹).
输出格式
Output the answer as described; separate multiple results with spaces in order, and output an empty line for an empty array.
样例 1
输入:
7 2
1 2 3 8 16 10 120
输出:
4
样例 2
输入:
6 10
10000 100 1000000 101 1010 1010000
输出:
3
样例 3
输入:
3 3
1 1 3
输出:
3
样例说明
Example 1: the non-negative integer powers of 2 are 1, 2, 8, and 16, for 4 items in total; 3, 10, and 120 are not.