3 solutions

  • 3
    @ 2026-3-28 15:54:45

    #include <bits/stdc++.h> using namespace std;

    int main() { long long x, y, sum = 0; cin >> x >> y; if (x > y) swap(x, y); for (int i = x; i <= y; i++) { bool q = 1; for (int j = 2; j <= sqrt(i); j++) if (i % j == 0) { q = 0; break; } if (q && i != 1) sum++; } cout << sum << endl; return 0; }

    Information

    ID
    12098
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    1
    Tags
    # Submissions
    22
    Accepted
    8
    Uploaded By