Submit | All submissions | Best solutions | Back to list |
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.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 |
hide comments
|
||||||||||||||
2013-05-02 16:12:19 shantanu mahajan
I'm too getting NZEC, using raw_input() and the code seems to be running fine on ideone.com any ideas? > MemoryError Last edit: 2013-05-02 17:12:15 |
||||||||||||||
2013-04-18 15:19:07 Simon Liang
@hliu You can try to hit the "run" link and run your submission on ideone.com and see what the runtime error is. Try to use raw_input(), and print functions instead of sys.stdin.readline() It seems to be more efficient. |
||||||||||||||
2013-04-18 14:48:23 hliu
I want to solve this problem by Python , but always get 'NZEC', I can't get it. What's the detailed information about 'NZEC'? i handle the input like this: == ca = int(sys.stdin.readline()[0:-1].split()[0]) for i in range(0, ca): lis = sys.stdin.readline()[0:-1].split() ..... is it right? Last edit: 2013-04-18 14:55:21 |
||||||||||||||
2013-04-18 13:38:40 vipul khullar
i have corrrectly solved the problem but have not got any points |
||||||||||||||
2013-04-17 13:30:29 Ashutosh Pandey
@Goutam Parashar instead of public class name simply class it will work |
||||||||||||||
2013-04-16 10:03:34 vipul khullar
my solution is correct but getting run time error |
||||||||||||||
2013-04-11 09:20:37 Przemys³aw Biernat
I use VC++ and my program works fine. If I submit compilation is ok but I get runtime error. Why if on VC++ everything is ok and compilation is ok. Something about use to large memory? |
||||||||||||||
2013-04-10 06:55:13 Mitch Schwartz
For Java, the submitted file is always run as Main.java, so you can either name your class Main, or you can remove the word public. |
||||||||||||||
2013-04-10 04:35:48 Goutam Parashar
i am getting this error on submission while its working fine for me.. can some one please tell me y is this coming... Main.java:6: class Prime_Generator is public, should be declared in a file named Prime_Generator.java public class Prime_Generator { ^ Note: Main.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error |
||||||||||||||
2013-04-09 06:34:57 Vijay Dhameliya
Can somebody please tell me for which input this solution (<snip>) is giving time limit exceed Please:-( Last edit: 2022-06-19 12:28:52 |