提交时间:2024-01-26 16:13:44

运行 ID: 129092

#include <bits/stdc++.h> using namespace std; int a[11000000]; int main(){ // freopen("prime.in", "r", stdin); // freopen("prime.out", "w", stdout); // int n; // cin >> n; for(int i = 2; i <= 100000; i++){ if(!a[i]){ for(int j = 2; i * j <= 100000; j++){ a[i * j] = 1; } } } for(int i = 2; i <= 100000; i++){ if(!a[i]){ cout << i << endl; } } return 0; }