There is a problem "Prime generators" in spoj.pl n codechef.com. I have successfully solved it but it is not getting submitted even after trying a lot. Please help. I am getting a wrong answer even though I think it is correct. It is satisfying all the cases known to me. The problem statement is (taken from http://www.spoj.pl/problems/PRIME1/):
Input
The input begins with the number t of test cases in a single line (t<=10).
In each of the next t lines there are two numbers m and n (1 <= m <= n
<= 1000000000, n-m<=100000) separated by a space.
Output
For every test case print all prime numbers p such that m <= p <= n, one number per
line, test cases separated by an empty line.
这是我的节目:
#include <iostream>
using namespace std;
#define LLI long long int
#define sll(n) scanf("%lld",&n)
#define s(n) scanf("%d",&n)
int main()
{
LLI m,n;
int t,count=0;
s(t);
while(t--)
{
sll(m);
sll(n);
int a[32000]={0};
int b[100005]={0};
for(LLI i=2;i*i<=n;i++)
{
if(!a[i])
{
for(LLI j=i*i;j*j<=n;j=j+i)
{
a[j]=1;
}
if(!(m%i))
b[0]=1;
for(LLI j=i-(m%i);j<=n-m;j=j+i)
{
if(m+j!=i)
b[j]=1;
}
}
}
if(m==1)
b[0]=1;
for(LLI i=0;i<=n-m;i++)
{
if(!b[i]){
printf("%lld
",m+i);
count++;
}
}
printf("
");
printf("%d",count);
}
return 0;
}