考虑第i 个和第i+1 个位置
交换之后则为
其他人的并没有改变
提取pre
同乘
L,R 均为正整数
因此将较小的放在前面更优
人生苦短,我用Python1
2
3
4
5
6
7
8
9
10
11
12
13n = int(input())
x, y = map(int, input().split())
w = []
for i in range(0, n):
L, R = map(int, input().split())
w.append({"L": L, "R": R, "val": L * R})
w.sort(key=lambda node: node["val"])
cnt = x
ans = 0
for i in range(0, n):
ans = max(ans, cnt // w[i]["R"])
cnt *= w[i]["L"]
print("%d" % ans, end="")