配料AI (CI翻译)
Problem Statement
题目描述
AI (CI翻译)Takahashi is at a ramen shop.
高桥正在一家拉面店里。AI (CI翻译)
This shop has $N$ kinds of toppings, and the $i$-th topping has a price of $i$ and a happiness of $W_i$.
这家店有 $N$ 种配料,第 $i$ 种配料的价格为 $i$,带来的幸福值为 $W_i$。AI (CI翻译)
Takahashi chooses three distinct kinds of toppings so that the total price is at most $V$. Find the maximum possible total happiness of the toppings he chooses.
高桥要从中选择三种互不相同的配料,使总价格不超过 $V$。求所选配料的幸福值之和的最大值。AI (CI翻译)
The constraints guarantee that there is at least one way to choose three distinct kinds of toppings so that the total price is at most $V$.
保证至少存在一种选择三种互不相同的配料且总价格不超过 $V$ 的方案。AI (CI翻译)
Constraints
约束条件
AI (CI翻译)$3 \leq N \leq 100$$6 \leq V \leq 3N-3$$1 \leq W_i \leq 10^6$- All input values are integers.
$3 \leq N \leq 100$$6 \leq V \leq 3N-3$$1 \leq W_i \leq 10^6$- 所有输入值均为整数。
Input
输入格式
AI (CI翻译)The input is given from Standard Input in the following format:
输入从标准输入按以下格式给出:AI (CI翻译)
N V
W_1 W_2 \dots W_N
N V
W_1 W_2 \dots W_NAI (CI翻译)
Output
输出格式
AI (CI翻译)Output the answer in one line.
将答案输出到一行中。AI (CI翻译)
样例
5 9
31 41 59 26 53
143
10 16
102228 448944 131224 326172 500169 670309 976672 579051 974511 773940
2095925
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。