欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1954A.Painting the Ribbon
Painting the Ribbon
Alice and Bob have bought a ribbon consisting of parts. Now they want to paint it.
First, Alice will paint every part of the ribbon into one of colors. For each part, she can choose its color arbitrarily.
Then, Bob will choose at most parts of the ribbon and repaint them into the same color (he chooses the affected parts and the color arbitrarily).
Bob would like all parts to have the same color. However, Alice thinks that this is too dull, so she wants to paint the ribbon in such a way that Bob cannot make all parts have the same color.
Is it possible to paint the ribbon in such a way?
Input
The first line contains one integer () — the number of test cases.
Each test case consists of one line containing three integers , and () — the number of parts, the number of colors and the number of parts Bob can repaint, respectively.
Output
For each test case, print YES if Alice can paint the ribbon so that Bob cannot make all parts have the same color. Otherwise, print NO.
You can print every letter in any register. For example, Yes, yes, yEs will all be recognized as positive answer.
Note
In the first test case, a ribbon consists of part. So all its parts will always have the same color.
In the second test case, there is only color.
In the third test case, Alice can paint the ribbon as follows: . It's impossible to change the color of at most part so that all parts have the same color.
In the fourth test case, no matter how Alice paints the ribbon, Bob will always be able to repaint parts so that all parts have the same color.
In the fifth test case, Alice can paint the ribbon as follows: . It's impossible to change the color of at most parts so that all parts have the same color.
Samples
5
1 1 1
5 1 1
5 2 1
5 2 2
5 5 3
NO
NO
YES
NO
YES
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |