简单题

 #include <iostream>
 #include <stdio.h>
 #include <string>
 #include <stack>
 #include <map>
 #include <vector>
 #include <algorithm>
 using namespace std;

 bool isPrime(int n) {
     ) return true;
      ==  || n == ) return false;
     ; i*i <= n; ++i) {
         ) return false;
     }
     return true;
 }

 int main()
 {
     int a, d, n;
     while (cin >> a >> d >> n && a && d && n) {
         while (n) {
             if (isPrime(a)) n--;
             ) cout << a << endl;
             a += d;
         }
     }

     ;
 }

poj: 3006的更多相关文章

  1. POJ中和质数相关的三个例题(POJ 2262、POJ 2739、POJ 3006)

    质数(prime number)又称素数,有无限个.一个大于1的自然数,除了1和它本身外,不能被其他自然数整除,换句话说就是该数除了1和它本身以外不再有其他的因数:否则称为合数.      最小的质数 ...

  2. POJ 3006 Dirichlet's Theorem on Arithmetic Progressions 素数 难度:0

    http://poj.org/problem?id=3006 #include <cstdio> using namespace std; bool pm[1000002]; bool u ...

  3. poj 3006 Dirichlet's Theorem on Arithmetic Progressions【素数问题】

    题目地址:http://poj.org/problem?id=3006 刷了好多水题,来找回状态...... Dirichlet's Theorem on Arithmetic Progression ...

  4. poj 3006 Dirichlet's Theorem on Arithmetic Progressions

    题目大意:a和d是两个互质的数,则序列a,a+d,a+2d,a+3d,a+4d ...... a+nd 中有无穷多个素数,给出a和d,找出序列中的第n个素数 #include <cstdio&g ...

  5. POJ 3006 Dirichlet&#39;s Theorem on Arithmetic Progressions 快筛质数

    题目大意:给出一个等差数列,问这个等差数列的第n个素数是什么. 思路:这题主要考怎样筛素数,线性筛.详见代码. CODE: #include <cstdio> #include <c ...

  6. Dirichlet's Theorem on Arithmetic Progressions POJ - 3006 线性欧拉筛

    题意 给出a d n    给出数列 a,a+d,a+2d,a+3d......a+kd 问第n个数是几 保证答案不溢出 直接线性筛模拟即可 #include<cstdio> #inclu ...

  7. POJ 3006 Dirichlet's Theorem on Arithmetic Progressions (素数)

    Dirichlet's Theorem on Arithmetic Progressions Time Limit: 1000MS   Memory Limit: 65536K Total Submi ...

  8. poj 3006水题打素数表

    #include<stdio.h> #include<string.h> #define N 1100000 int isprim[N],prime[N]; void ispr ...

  9. poj很好很有层次感(转)

    OJ上的一些水题(可用来练手和增加自信) (POJ 3299,POJ 2159,POJ 2739,POJ 1083,POJ 2262,POJ 1503,POJ 3006,POJ 2255,POJ 30 ...

随机推荐

  1. php读取memcahed java session

    PHP 共享 JAVA 保存的session信息 情景: 1:现在有两个系统,一个是Java做的系统,一个是PHP的系统,现在要把两个系统弄成一个单点登录. 2:两个系统两个库,两个库的表结构完全不同 ...

  2. android硬件调试之无法识别android设备解决办法

    DDMS 中无法识别华为荣耀六手机,  用豌豆荚开始显示无法连接,  用豌豆荚安装完驱动后,就可以连接了 http://www.zhihu.com/question/30588024 http://w ...

  3. js判断url是否有效

    方法一:(仅适用于ie) function CheckStatus(url) { XMLHTTP = new ActiveXObject("Microsoft.XMLHTTP") ...

  4. 1006 最长公共子序列Lcs

    1006 最长公共子序列Lcs 基准时间限制:1 秒 空间限制:131072 KB 给出两个字符串A B,求A与B的最长公共子序列(子序列不要求是连续的). 比如两个串为: abcicba abdks ...

  5. Magento打印(配送单、退款单、发票)时PDF中的乱码问题

    我使用Magento1.4.2,在其自带的TTF文件不能很好地解析中文字符,TTF文件的位置在网站根目录下的/lib/LinLibertineFont/中.打印的中文字符都是这样的 解决方法: 1.在 ...

  6. The "Real" Project Plan

    "I need a project plan by tomorrow morning." As project managers, that's what we hear. But ...

  7. Foundation和CoreFoundation之间的转换

    Foundation是OC的东西,CoreFoundation是C语言的东西 eg: NSString\NSArray\NSDictionary 属于Foundation CFStringRef\CF ...

  8. JMeter学习-012-JMeter 配置元件之-HTTP Cookie管理器-实现 Cookie 登录

    前文我们讲过了若何获取登录后的 Cookie 信息,不知如何获取登录 Cookie 的朋友,敬请参阅我之前写的博文:Fiddler-005-获取 Cookie 信息.参阅上篇文章,获取到 Cookie ...

  9. Selenium2学习-035-WebUI自动化实战实例-033-页面快照截图应用之三 -- 区域截图(专业版)

    之前有写过两篇博文讲述了 WebUI 自动化测试脚本中常用的截图方法,敬请参阅如下所示链接: 浏览器显示区域截图 浏览器指定区域截图 那么当需要截取的区域不在浏览器显示窗口范围之内时,之前的方法显然无 ...

  10. [转]Altium Designer 发现的机密

    转载自CrazyBingo博客. 进入电子设个世界,PCB是少不了的东西,刚开始画板子的时候,感觉好神奇.那个时候用的是Altium Designer Summer 08 ,现在用的是Altium D ...