Евгений составляет 6-буквенные слова из букв М, У, Ж, Ч, И, Н, А. Каждая из букв может встречаться в слове ровно один раз, причём первой буквой не может
Сколько различных слов может составить Евгений?
Приведём решение на языке Python.
from itertools import *
c = 0
count = 0
for w in product('МУЖЧИНА', repeat=6):
if w.count('Ж')==1 and w[0]!='Ч' and (w.count('М')<2) and (w.count('У')<2) and (w.count('Ч')<2) and (w.count('И')<2) and (w.count('Н')<2) and (w.count('А')<2):
c += 1
if c % 2 != 0:
count += 1
print(count)
Ответ: 1860.
Приведём решение Дилявера Усеиновича Измаилова на языке Python.
count = 0
c1 = 1
for s1 in 'МУЖЧИНА':
for s2 in 'МУЖЧИНА':
for s3 in 'МУЖЧИНА':
for s4 in 'МУЖЧИНА':
for s5 in 'МУЖЧИНА':
for s6 in 'МУЖЧИНА':
s = s1 + s2 + s3 + s4 + s5 + s6
if s[0]!='Ч' and (s.count('Ж') == 1) and (s.count('М') < 2) and (s.count('У') < 2) and (s.count('Ч') < 2) and (s.count('И') < 2) and (s.count('Н') < 2) and (s.count('А') < 2):
if (c1 % 2) == 1:
count += 1
c1 += 1
print(count)
Приведём решение Марины Крупенниковой на языке Python.
from itertools import permutations
count = 0
n = 0
alf = 'МУЖЧИНА'
for i in permutations(alf, 6):
if i[0] != 'Ч' and i.count('Ж') >= 1 :
n += 1
if n % 2 != 0:
count += 1
print(count)
Приведём решение Сергея Донец на языке PascalABC.NET.
begin
'МУЖЧИНА'.Permutations(6).Numerate
.Count(\(n,s)->(s[1]<>'Ч')and(s.CountOf('Ж')>0)and n.isodd).Print;
end.

