Farz0l1x

Untitled

May 29th, 2023
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. file = open('12A.txt')
  2. n = int(file.readline())
  3. A = []
  4. for i in range(n):
  5. A += [int(file.readline())]
  6.  
  7. Max = 0
  8. for i in range(n):
  9. for j in range(i + 1, n):
  10. if (A[i] % 23 == 0 or A[j] % 23 == 0) and (A[i] + A[j]) % 2 == 0:
  11. Max = max(Max, A[i] + A[j])
  12. print(Max)
  13.  
  14. k_0 = []
  15. k_1 = []
  16. k_0_23 = []
  17. k_1_23 = []
  18. for i in range(n):
  19. if A[i] % 2 == 0 and A[i] % 23 == 0:
  20. k_0_23 += [A[i]]
  21. elif A[i] % 2 == 1 and A[i] % 23 == 0:
  22. k_1_23 += [A[i]]
  23. elif A[i] % 2 == 0 and A[i] % 23 != 0:
  24. k_0 += [A[i]]
  25. elif A[i] % 2 == 1 and A[i] % 23 != 0:
  26. k_1 += [A[i]]
  27. k_0.sort()
  28. k_1.sort()
  29. k_0_23.sort()
  30. k_1_23.sort()
  31. print(k_0_23[-1] + k_0[-1], k_1_23[-1] + k_1[-1])
Advertisement
Add Comment
Please, Sign In to add comment