洛谷 P5736 【深基7.例2】质数筛
更多...
#include <luogu.h>
|
static int | main (istream &cin, ostream &cout) |
|
洛谷 P5736 【深基7.例2】质数筛
在文件 luogu.h 第 599 行定义.
◆ main()
int luogu::P5736::main |
( |
istream & | cin, |
|
|
ostream & | cout ) |
|
static |
在文件 luogu.cpp 第 2273 行定义.
2273 {
2276 bool notprime[100001];
2277 memset(notprime, 1, sizeof notprime);
2278 notprime[0] = false;
2279 notprime[1] = false;
2280 notprime[2] = true;
2281 for(unsigned int i = 2; i <= 50000; i++) {
2282 for(unsigned int j = 2; i * j <= 100000; j++) {
2283 notprime[i * j] = false;
2284 }
2285 }
2286 unsigned int num;
2287 for(
int _ = 0; _ <
n; _++) {
2288 cin >> num;
2289 if(notprime[num]) {
2290 cout << num << " ";
2291 }
2292 }
2293 return 0;
2294 }
被这些函数引用 luogu::TEST() , 以及 luogu::TEST().
该类的文档由以下文件生成: