Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
114194 王思颜 素数检测 C++ Output Limit Exceeded 72 MS 3172 KB 355 2025-03-22 11:07:02

Tests(0/1):


Code:

#include <bits/stdc++.h> using namespace std; int a[3000001]; int main() { for (int i = 2;i <= 300000;i++){ if (a[i] == 1){ continue; } for (int j = 2 * i;j <= 300000;j+=i){ a[j] = 1; } if (i * i > 300000){ break; } } for (int i = 2;i <= 3000000;i++){ if (a[i] == 0){ cout<<i<<" "; } } return 0; }