欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1725B.Basketball Together
Basketball Together
A basketball competition is held where the number of players in a team does not have a maximum or minimum limit (not necessarily players in one team for each match). There are candidate players in the competition that will be trained by Pak Chanek, the best basketball coach on earth. The -th candidate player has a power of .
Pak Chanek will form zero or more teams from the candidate players on the condition that each candidate player may only join in at most one team. Each of Pak Chanek's teams will be sent to compete once with an enemy team that has a power of . In each match, the team sent is said to defeat the enemy team if the sum of powers from the formed players is strictly greater than .
One of Pak Chanek's skills is that when a team that has been formed plays in a match, he can change the power of each player in the team to be equal to the biggest player power from the team.
Determine the maximum number of wins that can be achieved by Pak Chanek.
Input
The first line contains two integers and (, ) — the number of candidate players and the power of the enemy team.
The second line contains integers () — the powers of all candidate players.
Output
A line containing an integer representing the maximum number of wins that can be achieved by Pak Chanek.
Note
The -st team formed is a team containing players and . The power of each player in the team becomes . So the total power of the team is .
The -nd team formed is a team containing players , , and . The power of each player in the team becomes . So the total power of the team is .
Samples
6 180
90 80 70 60 50 100
2
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |