| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 86768 | 彭士宝 | 大力水手吃蔬菜 | Python3 | Wrong Answer | 33 MS | 3812 KB | 580 | 2024-07-27 19:38:03 |
n = int(input()) demand = [0] * n price = [0] * n for i in range(n): (demand[i], price[i]) = map(int, input().split()) cumulative_demand = [0] * (n + 1) for i in range(1, n + 1): cumulative_demand[i] = cumulative_demand[i - 1] + demand[i - 1] min_cost = float('inf') for i in range(n): if price[i] < min_cost: min_cost = price[i] for j in range(i + 1, n + 1): if cumulative_demand[j] - cumulative_demand[i] * min_cost < cumulative_demand[j] * price[j - 1]: min_cost = price[j - 1] print(min_cost * cumulative_demand[n])
------Input------
27 1 1 1 86 1 35 61 71 19 29 1 61 77 29 1 73 83 41 47 81 27 20 1 9 33 76 44 41 65 91 57 43 41 81 65 65 46 10 76 1 45 36 9 11 57 9 25 58 15 13 43 35 65 9
------Answer-----
1006
------Your output-----