Дудаков Денис Вадимович ИИКБ_119 LookSay 10707 | Андреева Елизавета, 522 LookSay 9484 | ||||
---|---|---|---|---|---|
f | 1 | from itertools import groupby | f | 1 | from itertools import groupby |
2 | 2 | ||||
3 | def LookSay(): | 3 | def LookSay(): | ||
n | 4 | term = '1' | n | 4 | curr_val = '1' |
5 | yield int(term) | 5 | yield int(curr_val) | ||
6 | while True: | 6 | while True: | ||
t | 7 | term = ''.join((str(len(list(group))) + k for k, group in groupby(term))) | t | 7 | curr_val = ''.join((str(len(list(g))) + k for k, g in groupby(curr_val))) |
8 | for t in term: | 8 | for i in curr_val: | ||
9 | yield int(t) | 9 | yield int(i) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|