| Иванюта Евгений Евгеньевич 327 LookSay 5113 | Виноградов Владимир Игоревич, ОУ Севастополь LookSay 5222 | ||||
|---|---|---|---|---|---|
| f | 1 | def LookSay(): | f | 1 | def LookSay(): |
| n | 2 | s = '1' | n | 2 | cur = '1' |
| 3 | while True: | 3 | while True: | ||
| n | 4 | for ch in s: | n | 4 | for ch in cur: |
| 5 | yield int(ch) | 5 | yield int(ch) | ||
| n | 6 | next_s = '' | n | 6 | nxt = '' |
| 7 | i = 0 | 7 | i = 0 | ||
| n | 8 | while i < len(s): | n | 8 | while i < len(cur): |
| 9 | count = 1 | 9 | cnt = 1 | ||
| 10 | while i + 1 < len(s) and s[i] == s[i + 1]: | 10 | while i + 1 < len(cur) and cur[i] == cur[i + 1]: | ||
| 11 | count += 1 | 11 | cnt += 1 | ||
| 12 | i += 1 | 12 | i += 1 | ||
| n | 13 | next_s += str(count) + s[i] | n | 13 | nxt += str(cnt) + cur[i] |
| 14 | i += 1 | 14 | i += 1 | ||
| t | 15 | s = next_s | t | 15 | cur = nxt |
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||