Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def foo(s, cnt):
- if s >= 68 and cnt % 2 == 1:
- return False
- elif s >= 68 and (cnt == 2 or cnt == 4):
- return True
- if cnt % 2 == 1:
- #Ходит Ваня победитель
- #Нам достаточно, чтобы хотябы один ход был хорошим
- return foo(s + 1, cnt + 1) or foo(s + 4, cnt + 1) or foo(s * 5, cnt + 1)
- else:
- #Мы должны выйигрывать при любой игре соперника
- return foo(s + 1, cnt + 1) and foo(s + 4, cnt + 1) and foo(s * 5, cnt + 1)
- def fooBe(s, cnt):
- if s >= 68 and cnt == 2:
- return False
- elif s >= 68 and (cnt == 1 or cnt > 2):
- return True
- if cnt % 2 == 1:
- #Ходит Ваня победитель
- #Нам достаточно, чтобы хотябы один ход был хорошим
- return foo(s + 1, cnt + 1) or foo(s + 4, cnt + 1) or foo(s * 5, cnt + 1)
- else:
- #Мы должны выйигрывать при любой игре соперника
- return foo(s + 1, cnt + 1) and foo(s + 4, cnt + 1) and foo(s * 5, cnt + 1)
- for i in range(1, 67):
- if fooBe(i, 0) and foo(i, 0):
- print(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement