We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
#include<map>#include<set>#include<list>#include<cmath>#include<ctime>#include<deque>#include<queue>#include<stack>#include<string>#include<bitset>#include<cstdio>#include<limits>#include<vector>#include<climits>#include<cstring>#include<cstdlib>#include<fstream>#include<numeric>#include<sstream>#include<iostream>#include<algorithm>#include<unordered_map>typedeflonglongintll;#define max 1000000usingnamespacestd;intmain(){intt;cin>>t;vector<ll>v;v.emplace_back(2);for(lli=3;i<max;++i){intf=0;for(llj=2;j<=sqrt(i);++j){if(i%j==0){f=1;break;}}if(f==0)v.emplace_back(i);++i;}for(inta0=0;a0<t;a0++){intn;cin>>n;cout<<v[n-1]<<endl;}return0;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #7: 10001st prime
You are viewing a single comment's thread. Return to all comments →