Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def count_presentations(n):
- print("n =", n)
- global options
- sub_bars = []
- print("подстроки: ")
- for i in range(len(n) - 1):
- option = n[i: i + 2]
- if option not in sub_bars:
- sub_bars.append(option)
- print("\t", option)
- for i in sub_bars:
- if int(n) != int(n[0]) + int(n[1]):
- j = n.find(i)
- n = n[:j] + str(int(n[j]) + int(n[j+1])) + n[j + 2:]
- print("Новый n =", n)
- if n not in options:
- options.append(n)
- count_presentations(n)
- n =int(input())
- options = ["1" * n]
- count_presentations(options[0])
- print(len(options))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement