Count Pairs
Submissions: 431   Accuracy:

13.07%

  Difficulty: Easy   Marks: 2

Given two non-negative integers A, B. Find number of pairs of integers (a,b) such that:
a+b=A
a3+b3=B

Input:

The first line of the test case contains an integer T denoting number of test cases. Each line of the test case contains two space separated integer A and B.

Output:

For each of the test case print the answer in separate line.

Constraints:

1<=T<=2.3*10^3
0<=A,B<=10^6

Examples:

Input:

1
3 9

Output:

2

Explanation:

Only (1,2) and (2,1) are such pairs.

 

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

Author: ShivamKD


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.