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
surya2196:
2016-04-05 19:12:44
lolypop question |
|
Sriharshaa Sammeta:
2015-09-03 12:32:42
can u please give explanation or some sort of idea about bitwise sieve ? |
|
SangKuan:
2015-07-18 18:07:12
in debug mode i use 2~3 second,but only use 0.77s in spoj,haha |
|
:.Mohib.::
2015-07-06 22:29:28
Nice One :) Last edit: 2015-07-06 22:30:54 |
|
V Y:
2015-06-24 09:42:10
Superb 'solution'. We don't have a formula. We don't need primality tests. What are we left with? Optimize 'space'. It will be enough but not optimal. Last edit: 2015-06-24 09:45:01 |
|
[Mayank Pratap]:
2015-06-20 10:22:50
Optimised Sieve leads to AC :) Superb Problem... |
|
Ankit Sultana:
2015-06-06 14:51:56
Awesome Problem!! |
|
Nitesh Tripathi:
2015-06-04 21:41:49
Learned a lot from this problem :) |
|
i_am_looser:
2015-05-25 08:09:27
bit-wise optimized sieve...... AC ;) |
|
karan:
2015-04-27 21:48:48
one of my favourite question <3 |
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 |