18 lines
591 B
Python
18 lines
591 B
Python
def get_count_digits_init(n: int, d: int) -> int:
|
|
return str(n).count(str(d))
|
|
|
|
|
|
MAX_N = 10001
|
|
count_digits_init = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0] for _ in range(MAX_N)]
|
|
|
|
if __name__ == '__main__':
|
|
for i in range(1, MAX_N):
|
|
for d in range(10):
|
|
count_digits_init[i][d] = get_count_digits_init(i, d) + count_digits_init[i - 1][d]
|
|
# with open('dh_20260909_11_count_digits_init.out', 'w') as f:
|
|
# f.write(str(count_digits_init).replace(" ", "").replace("]", "}").replace("[", "{"))
|
|
|
|
n, d = map(int, input().split())
|
|
print(count_digits_init[n][d])
|
|
|