Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- file = open('15A.txt')
- A = list(map(int, file.readlines()))
- Max = -10**9
- for i in range(len(A)):
- for j in range(i + 1, len(A)):
- if abs(A[i] - A[j]) % 80 == 0:
- Max = max(Max, A[i] - A[j])
- print(Max)
- file = open('15B.txt')
- A = list(map(int, file.readlines()))
- a = [[] for i in range(80)]
- for i in range(len(A)):
- ost = A[i] % 80
- a[ost] += [A[i]]
- b = []
- for i in range(80):
- a[i].sort()
- b += a[i][-1:]
- b += a[i][:1]
- ans = []
- for i in range(len(b)):
- for j in range(i + 1, len(b)):
- if abs(b[i] - b[j]) % 80 == 0:
- ans += [b[i] - b[j]]
- print(max(ans))
Advertisement
Add Comment
Please, Sign In to add comment