Advertisement
Korotkodul

N8

Apr 20th, 2023
540
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. def f(s, cnt):
  2.     if s >= 43 and cnt - 1 == 2:
  3.         return 1
  4.     if s >= 43 and cnt - 1 < 2:
  5.         return 0
  6.     if s < 43 and cnt - 1 == 2:
  7.         return 0
  8.  
  9.     A = f(s + 1, cnt + 1)
  10.     B = f(s + 2, cnt + 1)
  11.     C = f(s * 2, cnt + 1)
  12.     if cnt % 2 == 0:
  13.         return A or B or C
  14.     else:
  15.         return A and B and C
  16.  
  17. for s in range(43):
  18.     if f(s,0):
  19.         print(s)
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement