摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1262用筛选法求稍微方便一些:#include<iostream>using namespace std;#include<math.h>#define M 10005int a[M+1]={1,1};void is_prime() //预处理{ int m=(int)(sqrt(M*1.0)); for(int i=2;i<=m;i++) if(a[i]==0) for(int j=i*i;j<=M;j+=i) a[j]=1; }int main(){ ... 阅读全文
posted @ 2012-05-02 17:14 龙杉老师 阅读(363) 评论(0) 推荐(0)