scripts/ege/Основная волна. Второй день/20.py

14 lines
236 B
Python
Raw Normal View History

2023-05-05 00:45:01 +03:00
def f(x, p):
if x >= 165 or p > 4:
return p == 4
x = [f(x + 1, p + 1), f(x * 2, p + 1)]
if p % 2 == 1:
return any(x)
return all(x)
for s in range(1, 165):
if f(s, 1):
print(s)