Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for x in range(50): #кол-во единиц в исходной
- for y in range(50): #кол-во двоек в исх
- for z in range(50): #кол-во троек
- s = '0' + '1' * x + '2' * y + '3' * z
- while ('01' in s) or ('02' in s) or ('03' in s):
- s = s.replace('01', '2302', 1)
- s = s.replace('02', '10', 1)
- s = s.replace('03', '201', 1)
- if s.count('1') == 50 and s.count('2') == 12 and s.count('3') == 7:
- print('0' + '1' * x + '2' * y + '3' * z, x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement