Advertisement
Korotkodul

N11

Dec 20th, 2022
771
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. s = ''
  2. for i in range(85):
  3.     s += '1'
  4.  
  5. k = 0
  6. while s.count('11111') > 0:
  7.     #s = s.replace('111', '2')
  8.     #s = s.replace('222', '1')
  9.     l = len(s)
  10.     for i in range(l - 3):
  11.         if s[i:i+3] == '111':
  12.             s = s[:i] + '2' + s[i+3::]
  13.             break
  14.     l -= 2
  15.     for i in range(l - 3):
  16.         if s[i:i+3] == '222':
  17.             s = s[:i] + '1' + s[i+3::]
  18.             break
  19.     #print(s)
  20.     #print()
  21.     #k += 1
  22.     #if k > 10:
  23.         #break
  24.  
  25. print(s)
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement