Advertisement
Korotkodul

N9

Apr 20th, 2023
568
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(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.     A = f(s + 1, 0) or 2 * (s + 1) >= 43
  19.     B = f(s + 2, 0) or 2 * (s + 2) >= 43
  20.     C = f(s * 2, 0) or 4 * s >= 43
  21.     if A and B and C:
  22.         print(s)
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement