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
drazen167:
2013-05-25 18:14:41
I think my code is right and fast.
|
|
amitsingh749:
2013-05-24 08:50:26
time limit exceed why ....
|
|
coding:
2013-05-20 06:56:48
phewww!!! after so many tle..jst because i was taking numbers upto n/2...got AC when taking sqrt(n) :P :D
|
|
Jaideep:
2013-05-16 03:10:01
i always get TIME LIMIT exceeded, but my compiler shows less time than 6 seconds.any help ? |
|
LOST:
2013-05-15 10:57:01
.why the hell i am getting runtime error (SIGSEGV).......everytime...i have checkd that there is no array out of bound.... |
|
Balázs:
2013-05-13 18:25:19
I'm always getting "time limit exceeded". I'm using C++ with vector at the beginning, then after I'm just using pure arrays, but I'm always getting this! :( |
|
ওয়াসী (Wasi):
2013-05-13 17:42:34
@Kumar Gaurav SIGXFSZ is a sign that you output more than 33MB of data...
|
|
Kumar Gaurav:
2013-05-13 04:48:08
I also got this one time
|
|
Kumar Gaurav:
2013-05-13 04:46:31
I am getting this
|
|
MAYANK BHURA:
2013-05-11 03:20:39
for each of the invalid inputs, do we exit the method or re-accept it using do-while loops?
|
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 |