Advertisement
Ser1ousSAM

21

Jun 24th, 2021
1,044
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.97 KB | None | 0 0
  1. def f(x, y, pos):
  2.     if x+y>=100 and (pos==5 or pos==3):
  3.         return True
  4.     if x+y<100 and pos>=5:
  5.         return False
  6.     if x+y>100 and pos<5:
  7.         return False
  8.     if pos%2==0:
  9.         return f(x+5, y, pos+1) or f(x**2, y, pos+1) or f(x, y+5, pos+1) or f(x, y**2, pos+1)
  10.     else:
  11.         return f(x+5, y, pos+1) and f(x**2, y, pos+1) and f(x, y+5, pos+1) and f(x, y**2, pos+1)
  12.  
  13. def f1(x, y, pos):
  14.     if x + y >= 100 and pos == 3:
  15.         return True
  16.     if x + y < 100 and pos >= 3:
  17.         return False
  18.     if x + y > 100 and pos < 3:
  19.         return False
  20.     if pos % 2 == 0:
  21.         return f1(x + 5, y, pos + 1) or f1(x ** 2, y, pos + 1) or f1(x, y + 5, pos + 1) or f1(x, y ** 2, pos + 1)
  22.     else:
  23.         return f1(x + 5, y, pos + 1) and f1(x ** 2, y, pos + 1) and f1(x, y + 5, pos + 1) and f1(x, y ** 2, pos + 1)
  24.  
  25. for i in range(1, 96):
  26.     if f(3, i, 1):
  27.         print(i)
  28. print('asdas')
  29. for i in range(1, 96):
  30.     if f1(3, i, 1):
  31.         print(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement