惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tenable Blog
H
Heimdal Security Blog
K
Kaspersky official blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
S
Schneier on Security
G
GRAHAM CLULEY
U
Unit 42
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
C
CERT Recently Published Vulnerability Notes
Google DeepMind News
Google DeepMind News
罗磊的独立博客
Stack Overflow Blog
Stack Overflow Blog
阮一峰的网络日志
阮一峰的网络日志
Simon Willison's Weblog
Simon Willison's Weblog
C
Cisco Blogs
Cyberwarzone
Cyberwarzone
T
The Exploit Database - CXSecurity.com
Project Zero
Project Zero
Security Archives - TechRepublic
Security Archives - TechRepublic
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 司徒正美
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
V
Visual Studio Blog
博客园 - Franky
Engineering at Meta
Engineering at Meta
WordPress大学
WordPress大学
Jina AI
Jina AI
P
Proofpoint News Feed
P
Proofpoint News Feed
有赞技术团队
有赞技术团队
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园 - 聂微东
T
The Blog of Author Tim Ferriss
Spread Privacy
Spread Privacy
Application and Cybersecurity Blog
Application and Cybersecurity Blog
IT之家
IT之家
S
Security Affairs
博客园 - 叶小钗
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
N
News | PayPal Newsroom
Cloudbric
Cloudbric
AWS News Blog
AWS News Blog
W
WeLiveSecurity
The Last Watchdog
The Last Watchdog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
NISL@THU
NISL@THU

博客园 - 悠然小调

nothing.... Ogre中在SceneNode节点旁显示二维字的代码 博文阅读密码验证 - 博客园 最简单的智能指针原理 模板的特化 计算基类虚表指针在派生类中的偏移量 写一个内存拷贝函数 [转]来自 COM 经验的八个教训 COM本质论学习笔记(一)IDL winsock中select的作用 windows核心编程学习笔记(三)线程池(Thread Pooling) windows核心编程学习笔记(八)结构化异常处理(Structured Exception Handling) [转]亲密接触VC6.0编译器 windows核心编程学习笔记(七)DLL Injection and API Hooking windows核心编程学习笔记(五.续)堆 windows核心编程学习笔记(五)内存映射文件 windows核心编程学习笔记(四)windows内存结构/虚拟内存/线程的堆栈 windows核心编程学习笔记(二)Wait For Kernel Object(s) windows核心编程学习笔记(一)使用Critical Section
[转]筛选法求素数
悠然小调 · 2008-02-28 · via 博客园 - 悠然小调

[转]筛选法求素数

#include <iostream> #include <fstream>
using namespace std;
const int LENGTH=500;
bool Array[LENGTH]={false};
int main()
{
    ofstream FILE(
"Result.txt",ios::app);
   
for (int i=2;i<=LENGTH;++i)
    {
       
if (Array[i]==false)
        {
            cout
<<i<<" ";
            FILE
<<i<<" ";
           
for (int j=i+i;j<=LENGTH;j+=i)//HERE!筛选法求素数!
            {
                Array[j]
=true;
            }
        }
    }
    cout
<<endl;
    FILE
<<endl;
    FILE.close();
}

posted on 2008-02-28 23:17  悠然小调  阅读(286)  评论()    收藏  举报