Accept: 332 submit: 1218
Time Limit: 1000 msec memory limit: 32768 kb problem descriptioncompute the number of prime numbers in a given interval.
A prime number is an integer p greater than 1 whose only positive divisors are 1 and P.
Inputthe first line contains the number of test cases T (t <= 1000 ).
Each test case contains a single line with two numbers separated by a single space: A and B, 2 <= A <= B <= 1000000.
Outputfor each test case output a single line, containing the number of primes between A and B random Sive. sample input2 2 7 3 1000000 sample output4 78497 // note range (1-1000000) // unexpected solution, so that the foj Runtime is about S ,,..... // if you want to leave a message in a good way, thank you. # Include <iostream> <br/> # include <cmath> <br/> using namespace STD; <br/> const int max = 1000000; <br/> bool isprime [Max + 1]; <br/> int prime [Max]; <br/> int pnum; <br/> void getprime () <br/>{< br/> int I, j; <br/> memset (isprime, 0, sizeof (isprime); <br/> pnum = 0; <br/> for (I = 2; I <= max; I ++) <br/>{< br/> If (! Isprime [I]) prime [pnum ++] = I; <br/> for (j = 0; j <pnum & prime [J] * I <= max; j ++) <br/>{< br/> isprime [prime [J] * I] = 1; <br/> if (I % prime [J] = 0) break; <br/>}< br/> int main () <br/>{< br/> int N, A, B, count, I; <br/> getprime (); <br/> while (scanf ("% d", & N )! = EOF) <br/>{< br/> while (n --) <br/>{< br/> COUNT = 0; <br/> scanf ("% d", & A, & B); <br/> for (I = A; I <= B; I ++) <br/> If (isprime [I] = 0) <br/> count ++; <br/> printf ("% d/N", count ); <br/>}< br/> return 0; <br/>}