sir why is this code not working… please tell whats the error
Sir why is this code not working
not working…some error is coming… pls check my code and share the corrected one with me after making changes in my code
all test cases not passing… pls tell whats the error
Have you made the changes? Please send me your code
sir my code is already in collaboration mode… only one test case is passing and two are still not working… i cant understand whats wrong in the code… thats why i asked u to make changes in my code and share it with me… this is what i am asking from ur side
Please send me your current code. I cannot see any changes
sir see i have made all the changes that i could understand… pls check that as i have already turned on collaboration mode… i cant understand what all i should do to make my code run 100%… so pls u send me the corrected code
can u solve my doubt ???
@Vaibhav277 here is the correct code
#include
using namespace std;
#define ll long long
void prime_sieve(int a[]){
for (int i=3;i<=1000000;i+=2){
a[i]=1;
}
for (ll i=3;i<=1000000;i+=2){
if(a[i]==1){
for(ll j=i*i;j<=1000000;j=j+i){
a[j]=0;
}
}
}
a[0]=a[1]=0;
a[2]=1;
}
int main(){
int p[1000001]={0};
prime_sieve(p);
int csum[1000001]={0};
for(int i=0;i<=1000000;i++){
csum[i]=csum[i-1]+ p[i];
}
int q;
cin>>q;
while(q--){
int a,b;
cin>>a>>b;
cout<<csum[b]-csum[a-1]<<endl;
}
return 0;
}
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.