Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a = []
- n = 1000
- for i in range(n):
- a.append(int(input()))
- max7_1 = 0
- max7_2 = 0
- max_1 = 0
- max_2 = 0
- res = 0
- for x in a:
- if x % 160 != max7_1 % 160:
- if x + max7_1 > res:
- print(x, max7_1)
- res = max(res, x + max7_1)
- else:
- if x + max7_2 > res:
- print(x, max7_2)
- res = max(res, x + max7_2)
- if x % 7 == 0:
- if x % 160 != max_1 % 160:
- if x + max_1 > res:
- print(x, max_1)
- res = max(res, x + max_1)
- else:
- if x + max_2 > res:
- print(x, max_2)
- res = max(res, x + max_2)
- if x % 7 == 0:
- if x > max7_1:
- if x % 160 != max7_1 % 160:
- max7_2 = max7_1
- max7_1 = x
- elif x > max7_2:
- if x % 160 != max7_1 % 160:
- max7_2 = x
- else:
- if x > max_1:
- if x % 160 != max_1 % 160:
- max_2 = max_1
- max_1 = x
- elif x > max_2:
- if x % 160 != max_1 % 160:
- max_2 = x
- print(res)
- # max_mod = [0] * 120
- # res = 0
- # pair = (-1, -1)
- # for b in a:
- # x = max_mod[(120 - (b % 120)) % 120]
- # if (x + b) % 120 == 0 and (x + b) > res:
- # pair = (x, b)
- # max_mod[b % 120] = max(max_mod[b % 120], b)
- # print(pair)
- # cnt = 0
- # cnt2 = 0
- # cnt31 = 0
- # cnt62 = 0
- # for i in range(n):
- # if a[i] % 62 == 0:
- # cnt62 += 1
- # elif a[i] % 31 == 0:
- # cnt31 += 1
- # elif a[i] % 2 == 0:
- # cnt2 += 1
- # else:
- # cnt += 1
- # # cnt = 20
- # # cnt2 = 10
- # # cnt31 = 7
- # # cnt62 = 3
- # # 1, 2, 3
- # ans = 0
- # ans += cnt62 * cnt2
- # ans += cnt62 * cnt31
- # ans += cnt62 * cnt
- # ans += cnt31 * cnt2
- # ans += cnt62 * (cnt62 - 1) // 2
- # print(ans)
- # max_ = 0
- # max7 = 0
- # for i in range(n):
- # if a[i] % 7 != 0:
- # max_ = max(max_, a[i])
- # else:
- # max7 = max(max7, a[i])
- # for i in range(n):
- # if a[i] % 14 == 0 and a[i] > max14_1:
- # max14_2 = max14_1
- # max14_1 = a[i]
- # elif a[i] % 14 == 0 and a[i] > max14_2:
- # max14_2 = a[i]
- # elif a[i] % 7 and a[i] > max7_:
- # max7_ = a[i]
- # elif a[i] % 2 and a[i] > max2_:
- # a[i] = max2_
- # elif a[i] > max_:
- # max_ = a[i]
- # res = max([max_ * max14_1, max2_ * max7_, max14_2 * max14_1])
- #
- #
- #
- # print(max7 * max_)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement