123Y456 • 27天前
using namespace std;
int main() {
int n, m, ans = 0;
cin >> n >> m;
bool f = true;
for (int i = n; i <= m; ++i) {
f = true;
for (int j = 2; j * j <= i; j++) {
if (i % j == 0) {
f = false;
break;
}
if (f) {
ans++;
}
}
}
cout << ans;
return 0;
}
评论:
请先登录,才能进行评论