def w1(s):
if s <= 30:
return True
return (s - 3 <= 30) or (s - 5 <= 30) or (s // 4 <= 30)
def l1(s):
if s <= 30:
return False
return w1(s - 3) and w1(s - 5) and w1(s // 4)
def w2(s):
if s <= 30:
return True
if w1(s):
return True
return l1(s - 3) or l1(s - 5) or l1(s // 4)
def v_win(s):
if s <= 30:
return False
for ns in [s - 3, s - 5, s // 4]:
if ns <= 30:
continue
if not w2(ns):
return False
f = False
for ns in [s - 3, s - 5, s // 4]:
if ns > 30 and not w1(ns):
f = True
return f
# Задание 19
for s in range(31, 1000):
if not w1(s) and w1(s - 3) and w1(s - 5) and w1(s // 4):
print(s)
break
# Задание 20
r = []
for s in range(31, 1000):
if not w1(s) and w2(s):
r.append(s)
if len(r) == 2:
break
print(r[0], r[1])
# Задание 21
for s in range(31, 1000):
if v_win(s):
print(s)
break