地址:http://codeforces.com/contest/1437/problem/A
题意:
顾客购买区间[L,R]
保证对于任意[L,R]之间的x,满足存在a,使得x%a>=a/2(即顾客可以享受折扣,这个时候他愿意买a个而不是x个)
解析:
首先,a绝不能出现在[L,R]之间,因为会存在x%a==0,顾客不会多买。
贪心来讲,肯定选R之外的a,这个时候l~r %a都是本身。
那么有
2*x>=a
最小的L满足,那么R一定也满足,所以2*L>=a。
当2*L==a,而且R==2*L
那么选a==R,但是a一定要大于R,所以这个时候是无解的。
所以2*L>R
#include<iostream> #include<cstring> #include<algorithm> #include<cmath> using namespace std; typedef long long ll; int m[111][111]; int main() { int t; cin>>t; while(t--) { ll l,r; cin>>l>>r; if(l*2>r) cout<<"YES"<<endl; else cout<<"NO"<<endl; } }