欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1592A.Gamer Hemose
Gamer Hemose
One day, Ahmed_Hossam went to Hemose and said "Let's solve a gym contest!". Hemose didn't want to do that, as he was playing Valorant, so he came up with a problem and told it to Ahmed to distract him. Sadly, Ahmed can't solve it... Could you help him?
There is an Agent in Valorant, and he has weapons. The -th weapon has a damage value , and the Agent will face an enemy whose health value is .
The Agent will perform one or more moves until the enemy dies.
In one move, he will choose a weapon and decrease the enemy's health by its damage value. The enemy will die when his health will become less than or equal to . However, not everything is so easy: the Agent can't choose the same weapon for times in a row.
What is the minimum number of times that the Agent will need to use the weapons to kill the enemy?
Input
Each test contains multiple test cases. The first line contains the number of test cases . Description of the test cases follows.
The first line of each test case contains two integers and — the number of available weapons and the initial health value of the enemy.
The second line of each test case contains integers — the damage values of the weapons.
It's guaranteed that the sum of over all test cases doesn't exceed .
Output
For each test case, print a single integer — the minimum number of times that the Agent will have to use the weapons to kill the enemy.
Note
In the first test case, the Agent can use the second weapon, making health value of the enemy equal to . , so the enemy is dead, and using weapon time was enough.
In the second test case, the Agent can use the first weapon first, and then the second one. After this, the health of enemy will drop to , meaning he would be killed after using weapons times.
In the third test case, the Agent can use the weapons in order (third, first, third), decreasing the health value of enemy to after using the weapons times. Note that we can't kill the enemy by using the third weapon twice, as even though , it's not allowed to use the same weapon twice in a row.
Samples
3
2 4
3 7
2 6
4 2
3 11
2 1 7
1
2
3
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |