Advertisement
qekaqeka

code

Apr 27th, 2023
649
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. f = open(r'17 (17).txt')
  2.  
  3. a = list()
  4.  
  5. for s in f:
  6.     a.append(int(s))
  7.  
  8. t = 0
  9.  
  10. for el in a:
  11.     if (el % 100) % 11 == 0:
  12.         t = min(t, el)
  13.  
  14. t = t**2
  15.  
  16. c = 0
  17. mxs = 0
  18.  
  19. for i in range(len(a) - 1):
  20.     x = abs(a[i])
  21.     y = abs(a[i+1])
  22.  
  23.     fl1 = ((x % 13 == 0) + (y % 13 == 0)) == 1
  24.     fl2 = ((x % 10) == ((y % 100) // 10)) or ((y % 10) == ((x % 100) // 10))
  25.     fl3 = x**2 + y**2  <= t
  26.  
  27.     if all([fl1, fl2, fl3]):
  28.         c += 1
  29.         mxs = max(mxs, x**2 + y**2)
  30.  
  31. print(c, mxs)
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement