const int M=1000; bool mark[M]; void judge() { memset(mark,true,sizeof(mark)); mark[0]=mark[1]=false; for(int i=2;i*i<=M;i++) { if(mark[i]) { for(int j=i*i;j<=M;j+=i) mark[j]=false; } } }
posted on 2015-08-16 09:21 恶devil魔 阅读(155) 评论(0) 编辑 收藏 举报
Powered by: 博客园 Copyright © 2024 恶devil魔 Powered by .NET 8.0 on Kubernetes