Arithmetic Number
Submissions: 5326   Accuracy:

17.07%

  Difficulty: Easy   Marks: 2

Given three integers  'A' denoting the first term of an arithmetic sequence , 'C' denoting the common difference of an arithmetic sequence and an integer 'B'. you need to tell whether 'B' exists in the arithmetic sequence or not.

Input
First line of input contains of an integer 'T' denoting number of test cases. Then T test cases follow . Each test case contains three integers A,B,C.  Only line of each test case contains three integers A,B and C .

Output
For each case in a new line print 1 if B is found in sequence else print 0 if B is not found in sequence .

Constraints:
1<=t<=100
- 10^9 ≤ A, B, C ≤ 10^9


Example:

Input:

2
1 7 3
1 2 3

Output:
1
0

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Hardik Gulati
Author: hardikgulati96


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.