#include<stdio.h>
#include<math.h>
int sushu(int num)
{
int c=0;
for (int s = 3; pow(s,2) <= num; s=s+2)
{
if ((num % s) == 0)
c++;
}
return c;
}
int main()
{
int k,a,b;
scanf("%d", &k);
for (; k > 0; k--)
{
int n = 0,i,p,q;
scanf("%d %d", &a, &b);
{
if ((a % 2) == 0)
{
a = a + 1;
}
for (i = a; (i + 2) <= b; i = i + 2)
{
p=sushu(i);
q=sushu(i+2);
if ((p+q) == 0)
n++;
}
if (a == 1)
{
if (n != 0)
n = n - 1;
}
printf("%d\n", n);
}
}
}
在计算b=5000000显示时间超限,想知道哪里可以优化一下?以及怎么优化才好