# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
726622 | btkhg | Race (IOI11_race) | C++98 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<iostream>
using namespace std;
bool b[100000];
void ankh(int k){
int i=2;
while(i<=k){
if(!b[i]){
int j=i*2;
while(j<=k){
b[j]=1; j+=i;
}
}
i++;
}
}
int main(){
int n;
cin>>n;
ankh(n);
for(int i=2;i<=n;i++) if(!b[i]) cout<<i<<" ";
}