欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1296D.Fight with Monsters
Fight with Monsters
There are monsters standing in a row numbered from to . The -th monster has health points (hp). You have your attack power equal to hp and your opponent has his attack power equal to hp.
You and your opponent are fighting these monsters. Firstly, you and your opponent go to the first monster and fight it till his death, then you and your opponent go the second monster and fight it till his death, and so on. A monster is considered dead if its hp is less than or equal to .
The fight with a monster happens in turns.
- You hit the monster by hp. If it is dead after your hit, you gain one point and you both proceed to the next monster.
- Your opponent hits the monster by hp. If it is dead after his hit, nobody gains a point and you both proceed to the next monster.
You have some secret technique to force your opponent to skip his turn. You can use this technique at most times in total (for example, if there are two monsters and , then you can use the technique times on the first monster and time on the second monster, but not times on the first monster and times on the second monster).
Your task is to determine the maximum number of points you can gain if you use the secret technique optimally.
Input
The first line of the input contains four integers and () — the number of monsters, your attack power, the opponent's attack power and the number of times you can use the secret technique.
The second line of the input contains integers (), where is the health points of the -th monster.
Output
Print one integer — the maximum number of points you can gain if you use the secret technique optimally.
Samples
6 2 3 3
7 10 50 12 1 8
5
1 1 100 99
100
1
7 4 2 1
1 3 5 4 2 7 6
6
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |