Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- const int N=1000000;
- int main(){
- vector<bool> arr(N+1, true);//решето
- int a=2;
- while(1){
- int b=2;
- while(a*b<=N){
- arr[a*b]=false;
- b++;
- }
- if(b==2){
- break;
- }
- a++;
- }
- int n,m;
- cin>>m>>n;
- bool fl=true;
- for(int i=m;i<=n;i++){
- if(arr[i]){
- fl=false;
- cout<<i<<'\n';
- }
- }
- if(fl){
- cout<<"Absent";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement