Ishaan's Sum Problem
Submissions: 629   Accuracy:

45.02%

  Difficulty: Basic   Marks: 1

Ishaan is curious about numbers. He takes any 2 random numbers A and B. He wants to find out that whether A can be written as a sum of B distinct positive integers.Help him find out whether it is possible or not.

Input : 
First line of input contains a single integer T denoting the number of test cases.The only line of each test case contains 2 space-separated integers A and B.

Output : 
For each test case, print "1" if it is possible, else print "0" (without quotes "").

Constraints : 
1 <= T <= 104
1 <= A,B <= 10
6

Example : 
Input : 

3
5 2
6 2
5 3
Output : 
1
1
0

Explaination : 
Case 1 : 
5 can be written as a sum of 2 numbers : 1+4 or 2+3

Case 2 : 
6 can be written as a sum of 2 numbers : 1+5 or 2+4

Case 3 : 
5 can't be written as a sum of 3 numbers.

 

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

Author: goyalanubhav11


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.