A9459 | On Corruption and Numbers
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Alexey, a merry Berland entrant, got sick of the gray reality and he zealously wants to go to university. There are a lot of universities nowadays, so Alexey is getting lost in the diversity — he has not yet decided what profession he wants to get. At school, he had bad grades in all subjects, and it's only thanks to wealthy parents that he was able to obtain the graduation certificate.
The situation is complicated by the fact that each high education institution has the determined amount of voluntary donations, paid by the new students for admission — $n_{i}$ berubleys. He cannot pay more than $n_{i}$ , because then the difference between the paid amount and $n_{i}$ can be regarded as a bribe!
Each rector is wearing the distinctive uniform of his university. Therefore, the uniform's pockets cannot contain coins of denomination more than $r_{i}$ . The rector also does not carry coins of denomination less than $l_{i}$ in his pocket — because if everyone pays him with so small coins, they gather a lot of weight and the pocket tears. Therefore, a donation can be paid only by coins of denomination $x$ berubleys, where $l_{i}<=x<=r_{i}$ (Berland uses coins of any positive integer denomination). Alexey can use the coins of different denominations and he can use the coins of the same denomination any number of times. When Alexey was first confronted with such orders, he was puzzled because it turned out that not all universities can accept him! Alexey is very afraid of going into the army (even though he had long wanted to get the green uniform, but his dad says that the army bullies will beat his son and he cannot pay to ensure the boy's safety). So, Alexey wants to know for sure which universities he can enter so that he could quickly choose his alma mater.
Thanks to the parents, Alexey is not limited in money and we can assume that he has an unlimited number of coins of each type.
In other words, you are given $t$ requests, each of them contains numbers $n_{i},l_{i},r_{i}$ . For each query you need to answer, whether it is possible to gather the sum of exactly $n_{i}$ berubleys using only coins with an integer denomination from $l_{i}$ to $r_{i}$ berubleys. You can use coins of different denominations. Coins of each denomination can be used any number of times.
The situation is complicated by the fact that each high education institution has the determined amount of voluntary donations, paid by the new students for admission — $n_{i}$ berubleys. He cannot pay more than $n_{i}$ , because then the difference between the paid amount and $n_{i}$ can be regarded as a bribe!
Each rector is wearing the distinctive uniform of his university. Therefore, the uniform's pockets cannot contain coins of denomination more than $r_{i}$ . The rector also does not carry coins of denomination less than $l_{i}$ in his pocket — because if everyone pays him with so small coins, they gather a lot of weight and the pocket tears. Therefore, a donation can be paid only by coins of denomination $x$ berubleys, where $l_{i}<=x<=r_{i}$ (Berland uses coins of any positive integer denomination). Alexey can use the coins of different denominations and he can use the coins of the same denomination any number of times. When Alexey was first confronted with such orders, he was puzzled because it turned out that not all universities can accept him! Alexey is very afraid of going into the army (even though he had long wanted to get the green uniform, but his dad says that the army bullies will beat his son and he cannot pay to ensure the boy's safety). So, Alexey wants to know for sure which universities he can enter so that he could quickly choose his alma mater.
Thanks to the parents, Alexey is not limited in money and we can assume that he has an unlimited number of coins of each type.
In other words, you are given $t$ requests, each of them contains numbers $n_{i},l_{i},r_{i}$ . For each query you need to answer, whether it is possible to gather the sum of exactly $n_{i}$ berubleys using only coins with an integer denomination from $l_{i}$ to $r_{i}$ berubleys. You can use coins of different denominations. Coins of each denomination can be used any number of times.
输入格式
The first line contains the number of universities $t$ , ( $1<=t<=1000$ ) Each of the next $t$ lines contain three space-separated integers: $n_{i},l_{i},r_{i}$ ( $1<=n_{i},l_{i},r_{i}<=10^{9}; l_{i}<=r_{i}$ ).
输出格式
For each query print on a single line: either "Yes", if Alexey can enter the university, or "No" otherwise.
输入输出样例
输入 #1
2 5 2 3 6 4 5
输出 #1
Yes No
You can pay the donation to the first university with two coins: one of denomination 2 and one of denomination 3 berubleys. The donation to the second university cannot be paid.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted