NIKOLAY_TETUS

Untitled

Jun 19th, 2021 (edited)
333
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 21-2
  2. def F(x, y, p):
  3.     if x + y >= 30 and p == 5:
  4.         return True
  5.     elif x + y < 30 and p == 5:
  6.         return False
  7.     elif x + y >= 30 and p == 3:
  8.         return False
  9.  
  10.     if p % 2 == 1:
  11.         return F(x + 3, y, p + 1) and F(x * 2, y, p + 1) and F(x, y + 3, p + 1) and F(x, y * 2, p + 1)
  12.     else:
  13.         return F(x + 3, y, p + 1) or F(x * 2, y, p + 1) or F(x, y + 3, p + 1) or F(x, y * 2, p + 1)
  14.        
  15.    
  16. for s in range(1, 25):
  17.     if F(5, s, 1) == True:
  18.         print(s)
  19.  
RAW Paste Data