Smiley - Medicine

1.7

32 votes
Medium
Problem

A good , simple and beautiful Smile is the one which can enhance someone's charming personality. And in Lobe Town , Smiley has most beautiful Smile among all others.

Smiley loves his Smile very much and is very caring for his Smile. His Smile makes him unique in Lobe Town.

One day while roaming in town he met an accident and got hurt. His Smile turned down after that accident. People of Lobe Town are in great sadness as Smile of their town is lost somehow.

Somebody of them advised to cure him. but for this they have to go in another town named Healing Town. In Healing Town there is a doctor named Medicine. She is the only one who can heal our Smiley and give him his charming Smile back. So people of Lobe Town decided to go the Healing Town.

But there is a simple problem. Doctor Medicine can only be available in Healing Town only and only if her favourite number K exist equal to distance between these two towns and range starting from Source Point S to Destination Point D.

Help our Smiley to get his Smile back please :)

Note : Source Point and Destination Point are Inclusive

Input : First line of Input contains Number of Test Cases T . Next T lines contains three inputs S , D & K in same line

Output : Print the expected answer in new line for each Test Case

Constraint

0 <= T <= 100

0 <= S,D <= 10^4

0 <= K <=9

UPDATE : In this problem you are given Source and Destination . And an integer K. You have to find out if the number of occurrence of integer K is same in both , i.e. in between [Source, Destination] and in |Distance| Calculated. If it is same then print Yes else print No

Sample Input
21
102 502 7
42 8468 4
6501 9170 4
1479 9359 2
4465 5706 5
3282 6828 1
492 2996 2
4828 5437 1
4605 3903 3
293 2383 1
8717 9719 5
5448 1727 1
1539 1870 2
5668 6300 5
9895 8704 1
1323 334 3
4665 5142 1
8254 6869 7
7645 2663 7
38 2860 3
9742 7530 8
Sample Output
Yes
No
No
Yes
No
No
No
Yes
No
Yes
Yes
No
No
No
No
No
No
No
No
No
No
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Case 1 : Distance between towns is 400. And in range K = 7 appears 80 times so answer is Yes

Editor Image

?