Farz0l1x

Untitled

Dec 2nd, 2023
692
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.44 KB | None | 0 0
  1. file = open('10A.txt')
  2. A = list(map(int, file.readlines()))
  3. Max = 0
  4. for i in range(len(A)):
  5.     for j in range(i + 1, len(A)):
  6.         if (A[i] + A[j]) % 2 == 1:
  7.             Max = max(Max, A[i] + A[j])
  8. print(Max)
  9.  
  10. file = open('10B.txt')
  11. A = list(map(int, file.readlines()))
  12. a0 = []
  13. a1 = []
  14. for i in range(len(A)):
  15.     if A[i] % 2 == 0:
  16.         a0 += [A[i]]
  17.     else:
  18.         a1 += [A[i]]
  19. a0.sort()
  20. a1.sort()
  21. print(a0[-1] + a1[-1])
Advertisement
Add Comment
Please, Sign In to add comment