309156: CF1633C. Kill the Monster
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Kill the Monster
题意翻译
在某款电脑游戏里,角色初始生命 $hc$,初始攻击 $dc$。怪物初始生命 $hm$,初始攻击 $dm$。 而你有 $k$ 次机会,将攻击力**永久**提升 $w$ 或者将生命**永久**提升 $a$ 。 每一轮,角色攻击怪物,怪物掉 $dc$ 生命。怪物攻击角色,角色掉 $dm$ 生命。 问若干轮以后,角色能否击杀怪物并且角色存活。 击杀怪物定义为:怪物生命 $\ngtr 0$。 角色存活定义为:角色生命 $>0$。题目描述
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 $ h_C $ and attack $ d_C $ ; the monster initially has health $ h_M $ and attack $ d_M $ . The fight consists of several steps: 1. the character attacks the monster, decreasing the monster's health by $ d_C $ ; 2. the monster attacks the character, decreasing the character's health by $ d_M $ ; 3. the character attacks the monster, decreasing the monster's health by $ d_C $ ; 4. the monster attacks the character, decreasing the character's health by $ d_M $ ; 5. and so on, until the end of the fight. The fight ends when someone's health becomes non-positive (i. e. $ 0 $ 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 $ h_C $ and attack equal to $ d_C $ . He wants to slay a monster with health equal to $ h_M $ and attack equal to $ d_M $ . Before the fight, Monocarp can spend up to $ k $ 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 $ w $ , and each armor upgrade increases the character's health by $ a $ . Can Monocarp's character slay the monster if Monocarp spends coins on upgrades optimally?输入输出格式
输入格式
The first line contains one integer $ t $ ( $ 1 \le t \le 5 \cdot 10^4 $ ) — the number of test cases. Each test case consists of three lines: The first line contains two integers $ h_C $ and $ d_C $ ( $ 1 \le h_C \le 10^{15} $ ; $ 1 \le d_C \le 10^9 $ ) — the character's health and attack; The second line contains two integers $ h_M $ and $ d_M $ ( $ 1 \le h_M \le 10^{15} $ ; $ 1 \le d_M \le 10^9 $ ) — the monster's health and attack; The third line contains three integers $ k $ , $ w $ and $ a $ ( $ 0 \le k \le 2 \cdot 10^5 $ ; $ 0 \le w \le 10^4 $ ; $ 0 \le a \le 10^{10} $ ) — 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 $ k $ over all test cases does not exceed $ 2 \cdot 10^5 $ .
输出格式
For each test case, print YES if it is possible to slay the monster by optimally choosing the upgrades. Otherwise, print NO.
输入输出样例
输入样例 #1
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
输出样例 #1
YES
NO
YES
YES