some programs!
This commit is contained in:
1 parent
5d30e847c1
commit
ed054247d5
32 files changed
+1882
-149
No files matched your search
@@ -0,0 +1,17 @@
|
||||
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])
|
||||
|
||||
Reference in new issue
Block a user