fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. bool miku(int n){
  4. for (int i = 2; i * i <= n; i++) if (n % i == 0) return 0;
  5. return 1;
  6. }
  7. int main(){
  8. ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  9. int n,m; cin >> n >> m;
  10. int cnt = 0 , c = 0;
  11. for (int i = 1; i * i <= m; i++){
  12. if (miku(i)) ++cnt;
  13. }
  14. for (int i = 1; i * i <= n - 1; i++){
  15. if (miku(i)) ++c;
  16. }
  17. cout << cnt - c;
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
310