Advertisement
Korotkodul

N20_6647

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