[GESP202406 四级] 宝箱
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
题目描述
小杨发现了 个宝箱,其中第 个宝箱的价值是 。
小杨可以选择一些宝箱放入背包并带走,但是小杨的背包比较特殊,假设小杨选择的宝箱中最大价值为 ,最小价值为 ,小杨需要保证 ,否则小杨的背包会损坏。
小杨想知道背包不损坏的情况下,自己能够带走宝箱的总价值最大是多少。
输入格式
第一行包含两个正整数 ,含义如题面所示。
第二行包含 个正整数 ,代表宝箱的价值。
输出格式
输出一个整数,代表带走宝箱的最大总价值。
样例 #1
5 1
1 2 3 1 2
7
提示
【样例解释】
在背包不损坏的情况下,小杨可以拿走两个价值为 的宝箱和一个价值为 的宝箱。
【数据范围】
对于全部数据,保证有 ,,。
C++ GESP 2024年6月 四级
- Status
- Done
- Rule
- OI
- Problem
- 3
- Start at
- 2025-2-8 13:30
- End at
- 2025-2-16 21:30
- Duration
- 200 hour(s)
- Host
- Partic.
- 28