Advertisement
Farz0l1x

Untitled

Apr 17th, 2024
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. file = open('17_4542.txt')
  2. s = list(map(int, file.readlines()))
  3. min37 = 10**5
  4. max73 = -10**5
  5. for i in range(len(s)):
  6.     if abs(s[i]) % 37 == 0:
  7.         min37 = min(min37, s[i])
  8.     if abs(s[i]) % 73 == 0:
  9.         max73 = max(max73, s[i])
  10. print(min37, max73)
  11. #min37 > max73
  12. count = 0
  13. min_sum = 10**5
  14. for i in range(1, len(s)):
  15.     if (max73 < s[i] < min37 and (s[i-1] > min37 or s[i-1] < max73)) or (max73 < s[i-1] < min37 and (s[i] > min37 or s[i] < max73)):
  16.         count += 1
  17.         min_sum = min(min_sum, s[i-1] + s[i])
  18. print(count, min_sum)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement