Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #https://inf-ege.sdamgia.ru/problem?id=46966
- alph = 'РОСМАХ'
- gl = 'ОА'
- sogl = 'РСМХ'
- d = {'Р': 1, 'О': 2, 'С': 1, 'М': 1, 'А': 2, 'Х': 1}
- cnt = 0
- for q in alph:
- for w in alph:
- for e in alph:
- for r in alph:
- for t in alph:
- for y in alph:
- for u in alph:
- for i in alph:
- s = q + w + e + r + t + y + u + i
- f = 1
- for cur in range(1, 8):
- if s.count(s[cur]) != d[s[cur]]:
- f = 0
- if ((s[cur] in gl) and (s[cur - 1] in gl)) or ((s[cur] in sogl) and (s[cur - 1] in sogl)):
- f = 0
- if s.count(s[0]) != d[s[0]]:
- f = 0
- cnt += f
- print(cnt)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement