zhukov000

19-21

Jun 24th, 2021
622
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # +1 +4 *2
  2. # >= 40
  3.  
  4. def f(a):
  5.   if a + 1 >= 40 or a + 4 >= 40 or a * 2 >= 40:
  6.     return 1
  7.  
  8.   lst = [ f(a+1), f(a+4), f(a*2) ]
  9.   if min(lst) > 0:
  10.     return -max(lst)
  11.   return 1 - max([x for x in lst if x < 0])
  12.  
  13. for s in range(1, 40):
  14.   if f(s) == -1:
  15.     print("19 =>", s)
  16.   if f(s) == 2:
  17.     print("20 =>", s)
  18.   if f(s) == -2:
  19.     print("21 =>", s)
  20.  
RAW Paste Data