Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Chef’s current rating is X, and he wants to improve it. It is generally recommended that a person with rating X should solve problems whose difficulty lies in the range [X,X+200], i.e, problems whose difficulty is at least X and at most X+200.
You find out that Chef is currently solving problems with a difficulty of Y.
Is Chef following the recommended practice or not?
For each test case, output on a new line YES
if Chef is following the recommended practice style, and NO
otherwise.
Each letter of the output may be printed in either lowercase or uppercase. For example, the strings YES
, yEs
, and Yes
will be considered identical.
Input: 5
1300 1500
1201 1402
300 4000
723 805
1330 512
Output: YES
NO
NO
YES
NO
Test case 1: Chef’s current rating is 1300, so he should solve problems with difficulty lying in [1300,1500]. Since 1500 lies in [1300,1500], Chef is doing his practice in a recommended way 🙂
Test case 2: Chef’s current rating is 1201, so he should solve problems with difficulty lying in [1201,1401]. Since 1402 does not lie in [1201,1401], Chef is not doing his practice in a recommended way 🙁
Test case 3: Chef’s current rating is 300, so he should solve problems with difficulty lying in [300,500]. Since 4000 does not lie in [300,500], Chef is not doing his practice in a recommended way 🙁
Test case 4: Chef’s current rating is 723, so he should solve problems with difficulty lying in [723,923]. Since 805 lies in [723,923], Chef is doing his practice in a recommended way 🙂
Test case 5: Chef’s current rating is 1330, so he should solve problems with difficulty lying in [1330,1530]. Since 512 does not lie in [1330,1530], Chef is not doing his practice in a recommended way 🙁
#include<iostream>
using namespace std;
int main()
{
int t;
cin>>t;
if(t>=1&&t<=100)
{
while(t--)
{
int x,y;
cin>>x>>y;
if(y>=x&&y<=(x+200))
{
cout<<"YES"<<endl;
}
else
{
cout<<"NO"<<endl;
}
}
}
return 0;
}
t=int(input())
for i in range(t):
x,y=[int(i) for i in input().split()]
if y>=x and y<=x+200:
print("Yes")
else:
print("No")
In our experience, we suggest you solve this Rating Improvement CodeChef Solution and gain some new skills from Professionals completely free and we assure you will be worth it.
If you are stuck anywhere between any coding problem, just visit Queslers to get the Rating Improvement CodeChef Solution
I hope this Rating Improvement CodeChef Solution would be useful for you to learn something new from this problem. If it helped you then don’t forget to bookmark our site for more Coding Solutions.
This Problem is intended for audiences of all experiences who are interested in learning about Data Science in a business context; there are no prerequisites.
Keep Learning!
More Coding Solutions >>