欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1633C.Kill the Monster
Kill the Monster
Monocarp is playing a computer game. In this game, his character fights different monsters.
A fight between a character and a monster goes as follows. Suppose the character initially has health and attack ; the monster initially has health and attack . The fight consists of several steps:
- the character attacks the monster, decreasing the monster's health by ;
- the monster attacks the character, decreasing the character's health by ;
- the character attacks the monster, decreasing the monster's health by ;
- the monster attacks the character, decreasing the character's health by ;
- and so on, until the end of the fight.
The fight ends when someone's health becomes non-positive (i. e. or less). If the monster's health becomes non-positive, the character wins, otherwise the monster wins.
Monocarp's character currently has health equal to and attack equal to . He wants to slay a monster with health equal to and attack equal to . Before the fight, Monocarp can spend up to coins to upgrade his character's weapon and/or armor; each upgrade costs exactly one coin, each weapon upgrade increases the character's attack by , and each armor upgrade increases the character's health by .
Can Monocarp's character slay the monster if Monocarp spends coins on upgrades optimally?
Input
The first line contains one integer () — the number of test cases. Each test case consists of three lines:
The first line contains two integers and (; ) — the character's health and attack;
The second line contains two integers and (; ) — the monster's health and attack;
The third line contains three integers , and (; ; ) — the maximum number of coins that Monocarp can spend, the amount added to the character's attack with each weapon upgrade, and the amount added to the character's health with each armor upgrade, respectively.
The sum of over all test cases does not exceed .
Output
For each test case, print YES if it is possible to slay the monster by optimally choosing the upgrades. Otherwise, print NO.
Note
In the first example, Monocarp can spend one coin to upgrade weapon (damage will be equal to ), then health during battle will change as follows: $(h_C, h_M) = (25, 9) \rightarrow (25, 4) \rightarrow (5, 4) \rightarrow (5, -1)$. The battle ended with Monocarp's victory.
In the second example, Monocarp has no way to defeat the monster.
In the third example, Monocarp has no coins, so he can't buy upgrades. However, the initial characteristics are enough for Monocarp to win.
In the fourth example, Monocarp has coins. To defeat the monster, he has to spend coins to upgrade weapon and coins to upgrade armor.
Samples
4
25 4
9 20
1 1 10
25 4
12 20
1 1 10
100 1
45 2
0 4 10
9 2
69 2
4 2 7
YES
NO
YES
YES
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |