Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cells = list(map(int, input().split(', ')))
- print('По слоям')
- counters = [0] * (len(cells) + 1)
- i = 0
- while i < len(cells):
- if cells[i] % 23 != 0:
- i += 1
- continue
- j = i + 1
- while j < len(cells) and cells[j] % 23 == 0:
- j += 1
- lenght = j - i
- print(f'От {i + 1} до {j} содержится {lenght} ячеек')
- counters[lenght] += 1
- i = j
- print('По количеству')
- for l, c in enumerate(counters):
- if c == 0:
- continue
- print(f'Подпоследовательностей длиной {l}: {c}')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement