please help me out with this question… can u tell me where am i going wrong
Please help me out with this question
hello @Vaibhav277
your sieve size is small.
check value of 5000 000 th prime number from internet and then declare ur sieve size bigger than that. this will solve ur issue.
sir actually when i am increasing the sieve size greater than what i have used now then codei
is not running… can u pls make changes in code and share it with me
sir now problem of TLE is coming… what to do
Share ur updated code
#include using namespace std; #define ll long long #define t 86028121 int p[t+1]; void prime_sieve(int a[]){ for (ll i=3;i<=t;i+=2){ a[i]=1; } for (ll i=3;i<=t;i+=2){ if(a[i]==1){ for(ll j=i*i;j<=t;j=j+i){ a[j]=0; } } } a[0]=0; a[1]=0; a[2]=1; } int main(){ prime_sieve§; int test; cin>>test; for(int j=0;j<test;j++){ int count = 0; int n; cin>>n; for(ll i=0;i<=t;i++){ if(p[i]==1){ count++; if(count == n){ cout<<i<<endl; } } } } }
yes sir its working… thank u so much
not working… pls check whats the error
was it working earlier?