poj 3006水题打素数表
来源:互联网 发布:看门狗低配置优化补丁 编辑:程序博客网 时间:2024/06/16 15:45
#include<stdio.h>#include<string.h>#define N 1100000int isprim[N],prime[N];void isprime() { int i,j;memset(isprim,-1,sizeof(isprim)); isprim[1]=0; for(i=2;i<=1000;i++) if(isprim[i]==-1) { for(j=i*2;j<=1000000;j+=i) isprim[j]=0; }}int main() { isprime(); int a,d,n,i,k; while(scanf("%d%d%d",&a,&d,&n),a||d||n) { k=0; for(i=a;;i+=d) { if(isprim[i])k++; if(k==n)break; } printf("%d\n",i); }return 0;}
0 0
- poj 3006水题打素数表
- POJ 2739 素数打表
- poj 2992 Divisors (素数表)
- POJ 3006 Dirichlet's Theorem on Arithmetic Progressions(素数表)
- POJ 3006(线性筛素数)
- POJ 2689 素数打表再打表
- POJ 2262 Goldbach's Conjecture(素数表)
- POJ 2909 Goldbach's Conjecture(素数表)
- POJ 2773 欧拉函数, 素数表
- POJ 3518 简单素数打表
- POJ 2739 素数打表-----水题
- poj 2379 连续素数和 打表
- poj 3126(素数打表)
- poj 3126 (BFS + 素数打表)
- POJ 3126 bfs+素数打表
- POJ 3006 Dirichlet's Theorem on Arithmetic Progressions (筛选法素数打表)
- POJ 2739 素数筛选
- POJ 2739 素数
- c++内存分布
- 蓝桥杯蚂蚁感冒问题
- poj3259 Bellman-Ford
- Django1---安装,服务初步运行
- 鼠标单击变双击问题排查
- poj 3006水题打素数表
- Shell 的种类
- C# 将网页调用本地程序的URL Protocol 协议写到注册表中
- python与mysql连接的中文编码(在notepad++)
- Linux下MySQL数据库常用基本操作
- 一个令人深思的帖子!
- Codeforces Round #256 (Div. 2) C Painting Fence
- 请教俄罗斯方块的中的一些问题的解决方案???
- vb.net获取文件版本