TDKPRIME - Finding the Kth Prime
The problem statement is really simple. There are some queries. You are to give the answers.
Input
An integer stating the number of queries Q (equal to 50000), and Q lines follow, each containing one integer K between 1 and 5000000 inclusive.
Output
Q lines with the answer of each query: the Kth prime number.
Example
Input: 7 1 10 100 1000 10000 100000 1000000 Output: 2 29 541 7919 104729 1299709 15485863
hide comments
himanshu_159:
2018-01-14 07:29:58
@ayushgupta1997 how you got the max value
|
|
ayushgupta1997:
2017-12-09 11:53:04
Simple Problem ,attempted after 1 year AC in one go :)
|
|
Sushant Moon:
2017-10-06 00:01:57
Is there some problem with the test cases, i checked/compared/double-checked the prime numbers generated by my sieve for first 5million primes, with 5million primes from https://primes.utm.edu/lists/small/millions/, they check out all of them are correct. But the test cases is giving me WA.
|
|
kmkhan_014:
2017-08-28 13:20:24
took 0.6 s...how to improve upon time
|
|
harsh123_:
2017-01-25 05:28:13
Use Segmented Sieve...Took only 3.4MB space
|
|
madhavgaba:
2017-01-15 19:01:58
how can the top solution be 3.4M and 0.04 sec!!!! |
|
vivace:
2016-12-22 23:04:16
also , how is the memory use just 3.6 MB for best AC solution as per time limit.. sieve+an array till required takes 22MB in my case |
|
vivace:
2016-12-22 23:02:54
how are people getting 0.04 seconds while my nloglogn sieve of eratosthenes, several loop counter modifications alongwith scanf and printf got 0.56? |
|
iharsh234:
2016-07-08 11:44:04
do it just for bitwise seive.
|
|
blueranger:
2016-06-15 20:07:19
@Alfonso2 Peterssen Last submitted solution is working perfectly on my machine. Can you please tell me why am I getting WA?
|
Added by: | Alfonso² Peterssen |
Date: | 2010-04-06 |
Time limit: | 1.240s |
Source limit: | 10000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM32 ASM64 BF CLPS LISP sbcl LISP clisp ERL HASK ICON ICK JS-RHINO LUA NEM NICE OBJC OCAML PHP PIKE PRLG-swi SCALA SCM guile SCM qobi ST SQLITE TCL WHITESPACE |
Resource: | Thanks to TDuke |