PRIME1 - Prime Generator
Peter wants to generate some prime numbers for his cryptosystem. Help him! Your task is to generate all prime numbers between two given numbers!
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.
Example
Input: 2 1 10 3 5 Output: 2 3 5 7 3 5Warning: large Input/Output data, be careful with certain languages (though most should be OK if the algorithm is well designed)
Information
After cluster change, please consider PRINT as a more challenging problem.hide comments
code_new:
2013-10-24 01:26:41
Always time limit exceeded |
|
hector:
2013-10-17 16:25:56
What should be the output in case m = n (and assume m is not prime)?
|
|
Yuri Wergrzn:
2013-09-18 22:30:11
Runs in 0.12 sec but gives Wrong answer. I run as many test cases all over the range of values indicated and it works perfectly. Are trailing \n ignored (on end of output)? |
|
Shashikant Kumar:
2013-09-02 09:03:09
Below is link for the code which is working in local system for a lot of test cases. But Judge is giving "Wrong Answer".
|
|
Siddharth Bhal:
2013-09-01 13:57:40
Why segmentation fault on spoj. <snip>
|
|
ANURAG DAS:
2013-08-31 05:37:50
guys,i have tried sieve of eratosthenes for prime generation,yet time limit is crossed.
|
|
Pablo Fuente:
2013-08-30 04:42:19
I donĀ“t know how to output test cases with no primes in the range. So, What should be the output for this input a,b or c?
|
|
Rohit pal:
2013-08-28 04:33:09
time limit exceeded f**k this
|
|
Moudud:
2013-08-24 12:08:14
my code run and give right output in my pc but got RTE :( |
|
sazzad hossain:
2013-08-23 09:49:16
what is compilatin error?plz help
|
Added by: | Adam Dzedzej |
Date: | 2004-05-01 |
Time limit: | 6s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: NODEJS PERL6 |