QOJ.ac

QOJ

Time Limit: 4.0 s Memory Limit: 1024 MB Total points: 100 Hackable ✓

#15715. 超级 Smawk 兄弟

Statistics

你和 Bob 正在玩一款名为 Hyper Smawk Bros 的游戏,面对一个生命值为 $n$ 的 Boss。

你和 Bob 轮流行动,你先手。在你的回合,你可以选择一个整数 $x \in [1, m]$ 作为伤害值,将 $n$ 变为 $n - x$。但是,你不能使用对手上一回合刚刚使用的伤害值 $x$(游戏的第一回合,可以使用 $[1, m]$ 中的任意 $x$)。第一个将 Boss 生命值降至 $n \le 0$ 的玩家获胜。确定在 Bob 采取最优策略的情况下,你是否能获胜。

输入格式

每个测试包含多个测试用例。第一行包含测试用例的数量 $t$ ($1 \le t \le 10^4$)。

接下来是各测试用例的描述。

每个测试用例仅一行,包含两个整数 $n, m$ ($1 \le n \le 10^6, 2 \le m \le 10^6$),分别表示初始生命值 $n$ 和单次攻击的最大伤害 $m$。

注意,所有测试用例中 $n$ 的总和没有限制,所有测试用例中 $m$ 的总和也没有限制。

输出格式

对于每个测试用例,如果你能强制获胜,输出 YES,否则输出 NO。

判题系统对大小写不敏感(例如,YES, Yes, yes, yEs 均会被识别为肯定回答)。

样例

输入 1

8
6 9
20 10
69 2
42 9
42 10
44 9
44 10
400000 400000

输出 1

YES
YES
NO
NO
YES
YES
NO
YES

说明

样例 1 的解释:在第一个测试用例中,你可以立即造成 8 点伤害获胜,使得 $n$ 变为 $6 - 8 = -2 \le 0$。

在第二个测试用例中: 你选择造成 10 点伤害; Bob 可以选择 $[1, 10]$ 中除 10 以外的任意伤害值; * 然后你可以选择造成 10 点伤害并获胜。

在第三个测试用例中: 要么你先造成 1 点伤害,然后 Bob 必须造成 2 点伤害,接着你必须造成 1 点伤害,以此类推; 要么你先造成 2 点伤害,然后 Bob 必须造成 1 点伤害,接着你必须造成 2 点伤害,以此类推。

在这两种情况下,你都会输。

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#1037EditorialOpenNew Editorial for Problem #15715KiharaTouma2026-02-17 20:02:57View
#767Editorial Open题解Milmon2026-01-22 20:08:43 Download

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.