nq1s788

8 найти кол-во

Oct 19th, 2025
462
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. #https://inf-ege.sdamgia.ru/problem?id=17328
  2. alph = 'ГЕРАСИМ'
  3. gl = 'ЕАИ'
  4. sogl = 'ГРСМ'
  5. cnt = 0
  6. for q in alph:
  7.     for w in alph:
  8.         for e in alph:
  9.             for r in alph:
  10.                 for t in alph:
  11.                     for y in alph:
  12.                         for u in alph:
  13.                             s = q + w + e + r + t + y + u
  14.                             if len(set(s)) != 7:
  15.                                 continue
  16.                             f = True
  17.                             for i in range(1, 7):
  18.                                 if not ((s[i - 1] in gl and s[i] in sogl) or (s[i - 1] in sogl and s[i] in gl)):
  19.                                     f = False
  20.                             if f:
  21.                                 cnt += 1
  22. print(cnt)
Advertisement
Add Comment
Please, Sign In to add comment