# 43. 来自异国的客人-幸运数字
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
let input = [];
rl.on('line', function(num) {
let [k, n, m] = num.split(' ').map(Number);
if (k < 0 || n > 0 || m <= 1 || n >=m) {
console.log(0);
} else {
let ans = k.toString(m);
let count = 0;
for(let i=0; i<ans.length; i++) {
if (ans[i] == n) {
count++;
}
}
console.log(count);
}
});
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
← 42. 小明的幸运数 44. 园区参观路径 →