Advertisement
Korotkodul

N19-21_6646

Jun 17th, 2023
682
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1. def f(x,y,k):
  2.     bef = k - 1
  3.     if max(x,y) >= 50:
  4.         if bef == 3:
  5.             return 1
  6.         else: #bef < 3
  7.             return 0
  8.     elif bef == 3: #max(x,y) < 50
  9.         return 0
  10.     A = f(x + 3, y, k + 1)
  11.     B = f(2 * x, y, k + 1)
  12.     C = f(x, y + 3, k + 1)
  13.     D = f(x, 2 * y, k + 1)
  14.     if k % 2 == 1:
  15.         return A or B or C or D
  16.     else:
  17.         return A and B and C and D
  18. a = []
  19. for s in range(28):
  20.     if f(22, s, 1):
  21.         a.append(s)
  22. print(a)
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement