首页 > 其他分享 >Codeforces Round #232 (Div. 2)-B. On Corruption and Numbers

Codeforces Round #232 (Div. 2)-B. On Corruption and Numbers

时间:2023-06-12 17:35:00浏览次数:55  
标签:ni coins Codeforces li Numbers Round denomination ri he


原题链接


B. On Corruption and Numbers



time limit per test



memory limit per test



input



output



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

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

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



Input



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).



Output



For each query print on a single line: either "Yes", if Alexey can enter the university, or "No" otherwise.



Examples



input



2
5 2 3
6 4 5



output



Yes
No



Note



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.






若n < l输出No, 若n >= l && n <= r输出Yes, 若n > r则k = n / l, 也就是说可以有k个数字组成n, 在判断k * r >= n 若是则Yes.因为当K个数字都为l时,每个数字增长的大小为r - l, 设m = n - k * l,  b = m / (r - l) , b要小于等于k,若没有除尽则b要小于k, 此时m % (r - l)一定在1 到r - l之间


#include <bits/stdc++.h>
#define INF 1e18
#define maxn 105
using namespace std;
typedef long long ll;

int main(){
	
//	freopen("in.txt", "r", stdin);
	int t;
	ll n, l, r;
	
	scanf("%d", &t);
	while(t--){
		
		scanf("%I64d%I64d%I64d", &n, &l, &r);
		if(n < l)
		 puts("No");
		else if(n >= l && n <= r)
			puts("Yes");
		else{
			ll k1 = n / l;
			if(r * k1 >= n)
			 puts("Yes");
			else
			 puts("No");
		}
	}
	return 0;
}




标签:ni,coins,Codeforces,li,Numbers,Round,denomination,ri,he
From: https://blog.51cto.com/u_16158872/6464270

相关文章