Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- file = open('input.txt')
- A = list(map(int, file.readlines()))
- A = A[1:]
- a0_23 = []
- a1_23 = []
- a0 = []
- a1 = []
- n = len(A)
- for i in range(n):
- x = A[i]
- if x % 2 == 0 and x % 23 == 0:
- a0_23 += [x]
- elif x % 2 != 0 and x % 23 == 0:
- a1_23 += [x]
- elif x % 2 == 0 and x % 23 != 0:
- a0 += [x]
- elif x % 2 != 0 and x % 23 != 0:
- a1 += [x]
- a0_23.sort()
- a1_23.sort()
- a0.sort()
- a1.sort()
- print(max(a0[-1] + a0_23[-1], a1[-1] + a1_23[-1], a0_23[-1] + a0_23[-2], a1_23[-1] + a1_23[-2]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement