Input
The first line contains the number of test cases t (1 ≤ t ≤ 5). Then t test cases follow, each test case consists of a line containing two integers n and k (0 ≤ n ≤ 100000, n < k ≤ 1018).
Output
For each test case output one line containing the required number.
Example
Input:
2
1 5
2 5
Output:
2
3
Explanation:
In the first test case, the only sought pairs are (2,2) and (3,3). In the second one, they are (3,3), (3,4) and (4,3).
This is my problem to solve.My code is....
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
int i,j,test,n,k,p,s,r,q,y,c;
cin>>test;
for(c=0;c<test;c++){
int a=0;
cin>>n>>k;
y=n;
for(i=n+1;i<=k-1;i++)
for(j=n+1;j<=k-1;j++)
{
p=i*j-y;
q=i-y;
r=j-y;
s=q*r;
if(p%s==0)
{
p=0;
q=0;
r=0;
s=0;
a++;
}
else
{
p=0;
q=0;
r=0;
s=0;
}
}
cout<<a;}
getch();
return 0;
}
The output for n=1 and k=8 is 2 not correct(2).
Whats wrong?