Advertisement
nq1s788

8 перебор уникальных перестановок

Mar 19th, 2025 (edited)
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. from itertools import permutations
  2. a = list(permutations('ААААВВРР'))
  3. prev = set()
  4. num = 1
  5. for e in a:
  6.     s = ''.join(e)
  7.     if s not in prev:
  8.         print(num, s) #здесь проверять слово
  9.         prev.add(s)
  10.         num += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement