Advertisement
nq1s788

17 (пара подряд, сравнить с максимумом)

May 12th, 2024
830
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. #https://inf-ege.sdamgia.ru/problem?id=48438
  2. data = open('17.txt').readlines()
  3. mn = 10000000
  4. for i in range(len(data)):
  5.     a = int(data[i])
  6.     if abs(a) % 10 == 7:
  7.         mn = min(mn, a)
  8. cnt = 0
  9. mx = -10000000
  10. for i in range(len(data) - 1):
  11.     a = int(data[i])
  12.     b = int(data[i + 1])
  13.     if (a ** 2 + b ** 2 < mn ** 2) and (((abs(a) % 10 == 7) and (abs(b) % 10 != 7)) or ((abs(a) % 10 != 7) and (abs(b) % 10 == 7))):
  14.         cnt += 1
  15.         mx = max(mx, a ** 2 + b ** 2)
  16. print(cnt, mx)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement