Perfect bath
You are setting up a perfect bath for himself. You have X litres of hot water and Y litres of cold water.
The initial temperature of water in his bathtub is A degrees. On mixing water, the temperature of the bathtub changes as following:
-The temperature rises by 1 degree on mixing 1 litre of hot water.
-The temperature drops by 1 degree on mixing 1 litre of cold water.
Determine whether you can set the temperature to B degrees for a perfect bath.
Input:-4
24 25 2 0
37 37 2 9
30 20 10 9
30 31 0 20
Input Description: The first line of input will contain A single integer T, denoting The number of test cases.
-each test case consists of four space-separated integers A,B,X, and Y — The initial temperature of bathtub, The desired temperature of bathtub, The amount of hot water in litres, and The amount of cold water in litres respectively.
Output: YES
YES
NO
NO
Output Description: -For each test case, output on a new line, YES if you can get the desired temperature for his bath, and NO otherwise.
-You may print each character of the string in uppercase or lowercase (for example, the strings YES, yEs, yes, and yeS will all be treated as identical).
Constraints: 1<=T<=2000
0<=A,B<=40
0<=X,Y<=20
Explanation: Test case 1: The initial temperature of water is 24 and the desired temperature is 25. You have 2 litres of hot water. You can add 1 litre hot water in the tub and change the temperature to 24+1=25 degrees.
Test case 2: The initial temperature of water is 37 and the desired temperature is also 37. Thus, you don’t need to add any more water in the bathtub.
Test case 3: The initial temperature of water is 30 and the desired temperature is 20.You need to add 10 litres of cold water to reach the desired temperature. Since you only have 9 litres of cold water, you cannot reach the desired temperature.
Test case 4: The initial temperature of water is 30 and the desired temperature is 31. You need to add 1 litre of hot water to reach the desired temperature. Since you have no hot water, you cannot reach the desired temperature.