Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def t(n):
- if n % 10 == 9:
- n1 = (((n // 10) + 1) * 10) + 9
- return n1
- else:
- n2 = (((n // 10) + 1) * 10) + ((n % 10) + 1)
- return n2
- def f(curr, end):
- if curr > end:
- return 0
- if curr == end:
- return 1
- if curr < end:
- return f(curr + 1, end) + f(t(curr), end)
- print(f(25, 51))
- a = [0] * 100
- a[25] = 1
- for i in range(25, 51):
- if i + 1 <= 51:
- a[i + 1] += a[i]
- if t(i) <= 51:
- a[t(i)] += a[i]
- print(a[51])
Advertisement
Add Comment
Please, Sign In to add comment