You’re given three integers X, C, and Y, where X denotes the first term of an arithmetic sequence whose common difference is C. Your task is to determine whether Y belongs to this arithmetic sequence or not.
If X is 6 and C is 3, the sequence becomes 6,9,12,15,18,21,24…
The first line of input contains T, the number of test cases.
The first line of each test case contains three space-separated integers X, Y, and C as described in the problem statement.
For each test case print in a new line “True”, if Y belongs to the sequence otherwise “False”.
You don’t need to print anything. It has already been taken care of. Just implement the given function.
1 <= T <= 10^5
-10^8 <= X,C,Y <= 10^8
Time Limit: 1 sec
Sample Input 1:
6 18 3
6 17 3
Sample Output 1:
Explanation For Sample Input 1:
In the first case when X is 6 and C is 3, the sequence becomes 6,9,12,15,18,21,24…, in which 18 is a part of this sequence and 17 is not. Hence we print True for the first case and False for the second.
Sample Input 2:
4 2 -1
8 4 -3
Sample Output 2: