Казимагамедов Тагир 424 LookSay 8896 | Крет Вячеслав Александрович, 321 группа LookSay 8955 | ||||
---|---|---|---|---|---|
n | 1 | from itertools import groupby | n | 1 | from itertools import * |
2 | 2 | ||||
3 | def LookSay(): | 3 | def LookSay(): | ||
n | 4 | curr_ans = '1' | n | 4 | ans = '1' |
5 | while True: | 5 | while True: | ||
n | 6 | for el in curr_ans: | n | 6 | for i in ans: |
7 | yield int(el) | 7 | yield int(i) | ||
8 | new_ans = '' | 8 | new_ans = '' | ||
t | 9 | for i, group in groupby(curr_ans): | t | 9 | for i, j in groupby(ans): |
10 | new_ans += f'{len(list(group))}{i}' | 10 | new_ans += f'{len(list(j))}{i}' | ||
11 | curr_ans = new_ans | 11 | ans = new_ans |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|