Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
378 B
3
Indexable
Never
from itertools import permutations
lst = list(permutations('abcdefg'))
ans1 = 0
ans2 = 0
for tp in lst:
    if tp.index('a') < tp.index('b') and tp.index('b') < tp.index('c') and tp.index('d') < tp.index('e'):
        ans1 += 1
    if tp.index('a') > tp.index('b') and tp.index('b') > tp.index('c') and tp.index('d') > tp.index('e'):
        ans2 += 1
print(ans1, ans2)