13 条题解

  • 0
    @ 2025-6-5 16:50:24

    #include #include using namespace std; bool isPrime(int x) { if(x < 2) return false; for (int i = 2; i * i <= x; ++i) { if (x % i == 0) return false; } return true; } int main() { int m, n; cin >> m >> n; int low = min(m, n); int high = max(m, n); int count = 0; for (int i = low; i <= high; ++i) { if (isPrime(i)) { cout << i << " " ; count++; } } cout << endl << count << endl; }

    信息

    ID
    947
    时间
    1000ms
    内存
    128MiB
    难度
    6
    标签
    递交数
    1141
    已通过
    344
    上传者