39 lines
519 B
C++
39 lines
519 B
C++
#include <iostream>
|
|
#include <list>
|
|
#include <cmath>
|
|
using namespace std;
|
|
|
|
|
|
|
|
int main() {
|
|
ios::sync_with_stdio(0);
|
|
cin.tie(0);
|
|
|
|
int start, end;
|
|
|
|
cin >> start >> end;
|
|
|
|
int notPrimes[end + 5] = {0};
|
|
bool foundPrime = false;
|
|
|
|
for (int i = 2; i <= end; i++) {
|
|
if (notPrimes[i] != 0) {
|
|
continue;
|
|
}
|
|
|
|
if (start <= i && i <= end) {
|
|
cout << i << " ";
|
|
foundPrime = true;
|
|
}
|
|
|
|
for (int j = i; j <= end; j += i) {
|
|
notPrimes[j] = i;
|
|
}
|
|
}
|
|
|
|
if (!foundPrime) {
|
|
cout << "Absent" << endl;
|
|
}
|
|
|
|
return 0;
|
|
} |