提交时间:2023-11-13 21:11:43

运行 ID: 31056

#include <bits/stdc++.h> using namespace std; int main() { int n, cnt = 0; cin >> n; for (int i = 2; i <= n; ++ i) { bool f = true; for (int j = 2; j < i; ++ j) { if (i % j == 0) f = false; } if (f == true) cnt++; } cout << cnt; return 0; }