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.
using namespace std;
int main() {
int t; long long int n; double c=0; double k=0;
cin>>t; long long int i; long long int j;
while(t--)
{
cin>>n;
vector v;
for(i=2;i<=n;i++)
{
j=1;
while(j<=i/2)
{
if(i%j==0)
c+=1;
j++;
}
if(c==1 && ((2*i)<=n))
{
v.insert(v.begin()+k,i);
k+=1;
}
c=0;
}
k=0;
for(i=0;i
}
}
what is the problem is my code
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #187: Semiprimes
You are viewing a single comment's thread. Return to all comments →
include
include
include
using namespace std; int main() { int t; long long int n; double c=0; double k=0; cin>>t; long long int i; long long int j; while(t--) { cin>>n; vector v; for(i=2;i<=n;i++) { j=1; while(j<=i/2) { if(i%j==0) c+=1; j++; } if(c==1 && ((2*i)<=n)) { v.insert(v.begin()+k,i); k+=1; } c=0; } k=0; for(i=0;i } } what is the problem is my code