Advertisement
qekaqeka

code

Apr 10th, 2023
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. f = open(r'17 (16).txt')
  2.  
  3. msq = 100000000
  4.  
  5. for s in f:
  6. if s[-1] == s[-2]:
  7. msq = min(msq, int(s))
  8.  
  9. f.seek(0,0)
  10.  
  11. msq = msq**2
  12.  
  13. c = 0
  14. mxsq = 0
  15.  
  16. a = int(f.readline())
  17.  
  18. for s in f:
  19. b = int(s)
  20. aa = abs(a)
  21. ab = abs(b)
  22. f1 = (aa % 10 == (ab % 100 // 10)) or (ab % 10 == (aa % 100 // 10))
  23.  
  24. f2 = (a**2 + b**2) <= msq
  25.  
  26. f3 = (aa % 7 == 0 and ab % 7 != 0) or (ab % 7 == 0 and aa % 7 != 0)
  27.  
  28. if f1 and f2 and f3:
  29. c += 1
  30. mxsq = max(mxsq, a**2 + b**2)
  31.  
  32. a = b
  33.  
  34. print(c, mxsq)
  35.  
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement