NIKOLAY_TETUS

20

Jun 20th, 2021
831
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Петя ходит первый
  2. def F(x, y, p):
  3.     if x + y >= 87 and p == 4:
  4.         return True
  5.     elif x + y < 87 and p == 4:
  6.         return False
  7.     elif x + y >= 87 and p == 2:
  8.         return False
  9.  
  10.     if p % 2 == 0:
  11.         return F(x + 1, y, p + 1) or F(x * 2, y, p + 1) or F(x, y + 1, p + 1) or F(x, y * 2, p + 1)
  12.     else:
  13.         return F(x + 1, y, p + 1) and F(x * 2, y, p + 1) and F(x, y + 1, p + 1) and F(x, y * 2, p + 1)
  14.  
  15. for S in range(1, 78):
  16.     if F(9, S, 1) == True:
  17.         print(S)
  18.  
RAW Paste Data