Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input())
- a = [[10 ** 25]* 2 for i in range(35)]
- for i in range(n):
- x = int(input())
- y = x % 35
- if a[y][0] > x:
- a[y][1] = a[y][0]
- a[y][0] = x
- elif a[y][1] > x:
- a[y][1] = x
- ans1 = 10**25
- ans2 = 10**25
- for i in range(35):
- for j in range(35):
- if (i * j) % 35 == 0:
- if (i == j):
- ans1 = min(ans1, a[i][0] * a[i][1])
- else:
- ans1 = min(ans1, a[i][0] * a[j][0])
- else:
- if (i == j):
- ans2 = min(ans2, a[i][0] * a[i][1])
- else:
- ans2 = min(ans2, a[i][0] * a[j][0])
- print(ans1, ans2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement