CF1437A.Marketing Scheme

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You got a job as a marketer in a pet shop, and your current task is to boost sales of cat food. One of the strategies is to sell cans of food in packs with discounts.

Suppose you decided to sell packs with aa cans in a pack with a discount and some customer wants to buy xx cans of cat food. Then he follows a greedy strategy:

  • he buys ⌊xa⌋\left\lfloor \frac{x}{a} \right\rfloor packs with a discount;
  • then he wants to buy the remaining (x mod a)(x \bmod a) cans one by one.

⌊xa⌋\left\lfloor \frac{x}{a} \right\rfloor is xx divided by aa rounded down, x mod ax \bmod a is the remainer of xx divided by aa.

But customers are greedy in general, so if the customer wants to buy (x mod a)(x \bmod a) cans one by one and it happens that (x mod a)≥a2(x \bmod a) \ge \frac{a}{2} he decides to buy the whole pack of aa cans (instead of buying (x mod a)(x \bmod a) cans). It makes you, as a marketer, happy since the customer bought more than he wanted initially.

You know that each of the customers that come to your shop can buy any number of cans from ll to rr inclusive. Can you choose such size of pack aa that each customer buys more cans than they wanted initially?

你受聘为一家宠物店的营销人员,当前的任务是提升猫粮的销量。其中一种策略是以折扣价将猫粮罐头打包销售。

假设你决定以每包 aa 罐的方式进行折扣销售,而某位顾客希望购买 xx 罐猫粮。该顾客将采用贪心策略:

  • 他首先购买 ⌊xa⌋\left\lfloor \frac{x}{a} \right\rfloor 包折扣装;
  • 然后他打算单独购买剩余的 (x mod a)(x \bmod a) 罐。

其中,⌊xa⌋\left\lfloor \frac{x}{a} \right\rfloor 表示 xx 除以 aa 后向下取整,x mod ax \bmod a 表示 xx 除以 aa 的余数。

但顾客总体上是贪心的:若顾客打算单独购买 (x mod a)(x \bmod a) 罐,且恰好满足 (x mod a)≥a2(x \bmod a) \ge \frac{a}{2},则他会转而购买一整包 aa 罐(而非仅买 (x mod a)(x \bmod a) 罐)。这让你——作为营销人员——感到高兴,因为顾客最终购买的数量超过了其最初的需求量。

已知光顾你店铺的每位顾客,其计划购买的罐头数量均在区间 [l,r][l, r] 内(含端点)。是否存在某个打包规格 aa,使得每一位顾客最终购买的罐头总数都严格大于其最初计划购买的数量?

输入格式

The first line contains a single integer tt (1≤t≤10001 \le t \le 1000) — the number of test cases.

The first and only line of each test case contains two integers ll and rr (1≤l≤r≤1091 \le l \le r \le 10^9) — the range of the number of cans customers can buy.

第一行包含一个整数 tt(1≤t≤10001 \le t \le 1000)—— 测试用例的数量。

每个测试用例仅有一行,包含两个整数 ll 和 rr(1≤l≤r≤1091 \le l \le r \le 10^9)—— 顾客可购买的罐头数量的范围。

输出格式

For each test case, print YES if you can choose such size of pack aa that each customer buys more cans than they wanted initially. Otherwise, print NO.

You can print each character in any case.

对于每个测试用例,如果存在某个包装规格 aa,使得每位顾客购买的罐头数量均多于其最初想要的数量,则输出 YES;否则输出 NO。

你可以以任意大小写形式输出每个字符。

输入输出样例

  • 输入#1

    3
    3 4
    1 2
    120 150

    输出#1

    YES
    NO
    YES

说明/提示

In the first test case, you can take, for example, a=5a = 5 as the size of the pack. Then if a customer wants to buy 33 cans, he'll buy 55 instead (3 mod 5=33 \bmod 5 = 3, 52=2.5\frac{5}{2} = 2.5). The one who wants 44 cans will also buy 55 cans.

In the second test case, there is no way to choose aa.

In the third test case, you can take, for example, a=80a = 80.

在第一个测试用例中,例如可取 a=5a = 5 作为包装规格。此时,若顾客想购买 33 罐,他将实际购买 55 罐(因为 3 mod 5=33 \bmod 5 = 3,且 52=2.5\frac{5}{2} = 2.5)。想购买 44 罐的顾客也将购买 55 罐。

在第二个测试用例中,不存在满足条件的 aa。

在第三个测试用例中,例如可取 a=80a = 80。

输入解题思路,AI测评打分。不知道怎么写?

首页