We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 12729fa commit 8e668d9Copy full SHA for 8e668d9
Codechef/SATBIRCC.cpp
@@ -0,0 +1,34 @@
1
+
2
+#include <bits/stdc++.h>
3
+using namespace std;
4
+#define MAX_SIZE 1000005
5
+void fnc(vector<int> &primes)
6
+{
7
+ bool IsPrime[MAX_SIZE];
8
+ memset(IsPrime, true, sizeof(IsPrime));
9
+ for (int p = 2; p * p < MAX_SIZE; p++)
10
+ {
11
+ if (IsPrime[p] == true)
12
13
+ for (int i = p * p; i < MAX_SIZE; i += p)
14
+ IsPrime[i] = false;
15
+ }
16
17
+ for (int p = 2; p < MAX_SIZE; p++)
18
+ if (IsPrime[p])
19
+ primes.push_back(p);
20
+}
21
22
+int main()
23
+{ int t;
24
+cin>>t;
25
+while(t--){
26
+ vector<int> primes;
27
+ fnc(primes);
28
+ int n;
29
+ cin>>n;
30
+ cout << primes[n-1] << endl;
31
32
+ return 0;
33
34
0 commit comments