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 — ni berubleys. He cannot pay more than ni, because then the difference between the paid amount andni 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 ri. The rector also does not carry coins of denomination less than li 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 xberubleys, where li ≤ x ≤ ri (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 ni, li, ri. For each query you need to answer, whether it is possible to gather the sum of exactly ni berubleys using only coins with an integer denomination from li to ri 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:ni, li, ri (1 ≤ ni, li, ri ≤ 109; li ≤ ri).
For each query print on a single line: either "Yes", if Alexey can enter the university, or "No" otherwise.
2 5 2 3 6 4 5
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.
题意:
给出T(1 ~ 1000)个case,每次给出N,L,R(1 <= N,L,R <= 10 ^ 9)代表有能不能由 L 到 R 内的数组成N。
思路:
数学。
给出的 L 到 R 内的数如果每次只选择一个数,则能组成 L ~ R这么多的数;若每次选择两个数,则能组成 2 * L ~2 * R内的数;选择 K 个,则为 K * L ~ K * R 这么多的数。如果 N 属于 K 区间内的数,则能满足要求,若找不到一个K 满足 K * L <= N <= K * R,则不能满足要求。注意用long long 即可。
AC:
#include<stdio.h> int main() { int t; scanf("%d",&t); while(t--) { __int64 n,l,r; scanf("%I64d%I64d%I64d",&n,&l,&r); if(r * (n / l) >= n) printf("Yes\n"); else printf("No\n"); } return 0; }
相关推荐
Spotlight Cases是一款专门为Spotlight on Corruption项目开发的WordPress插件,它的主要目的是为了增强网站的功能,以便更好地展示、管理和追踪腐败案件的相关信息。这个插件是用PHP编程语言编写的,因此,它充分...
在编程过程中,尤其是在C语言和使用Visual C++(VC)编译器的环境中,"heap corruption detected after normal block"是一个常见的错误提示,它通常表明在程序执行时内存堆出现了损坏。这个错误通常与动态内存分配(如...
在Linux系统中,CentOS 7使用XFS文件系统可能会遇到一种特定的错误:“Corruption of in-memory data detected”。这个错误通常表示系统检测到了内存中的数据损坏,这可能是因为不正常关机、硬件故障或者软件问题...
Curbing Corruption
Once you install and start 3ds Max 2019.2 Update, you will have to consent to allowing the security tools to look for the corruption causing 3rd party scripts through your startup scripts. We strongly...
然而,以往的研究主要集中在就地腐败(in-place corruption),即在不改变元素位置的情况下对每个像素或令牌个体添加噪声。 本文“超越就地腐败插入和删除”探讨了DDPMs中更广泛的数据腐败过程和去噪模型,这些模型...
使用命令aarch64-linux-gnu-gcc -Wall test.c -o test_lora -DLORADATA_V1 ./libloradec.a -lpthread -lm命令进行编译 一般人下载没用,需要符合国网MQTT协议的无线2.4G或者470M传感器以及对应的接入模组才能在程序...
【Corruption 4.5 Version 7_[unknowncheats.me]__game_】是一个与《荣誉勋章:盟军突击》(Medal of Honor: Allied Assault)游戏相关的资源或修改工具,由unknowncheats.me社区发布。这个压缩包可能包含了一个作弊...
"Corruption Fixer" 是一款开源的工具,其主要功能是针对在数据传输过程中可能出现的文件损坏问题进行检测和修复。在我们的日常生活中,无论是通过网络邮件、云存储服务还是USB设备传输文件,都可能遇到文件在传输后...
Memory Corruption(解决方案).md
Heap Corruption(解决方案).md
Data Corruption Detected(处理方案).md
Memory Corruption Detected(亲测可用).md