简单题

 #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. 安装faac编译问题

    mpeg4ip.h:126: error: new declaration ‘char* strcasestr(const char*, const char*)’分类: Linux开发相关 2012 ...

  2. Mac 下 命令收藏

    1.查看文件的二进制 xxd -b test.wav 2.所有占用的端口 sudo lsof -i -P | grep -i "listen" 原文地址:Mac 下 命令收藏标签: ...

  3. 蓝牙BLE ATT剖析(二)-- PDU

    一.Error Handling Error Response The Error Responseis used to state that a given request cannot be pe ...

  4. Android Studio工具修理集

    本文来自http://blog.csdn.net/liuxian13183/ ,引用必须注明出处! 1.Common依赖项目找不到.因为主项目没有引进setting.gradle 2.从Eclipse ...

  5. Tinyxml的简单应用

    参考文章: 1-> http://www.cnblogs.com/phinecos/archive/2008/03/11/1100912.html 2-> http://blog.csdn ...

  6. oracle入门-%的用法

    vempno emp.empno%type; 例如上面的这句话,你的vempno就是你定义的变量,和面的那个emp是你数据库里面存在的表,他的表里面有意个empno字段,然后%type就是empno的 ...

  7. 【转】shell脚本中echo显示内容带颜色

    shell脚本中echo显示内容带颜色显示,echo显示带颜色,需要使用参数-e.格式如下:   echo -e "\033[41;36m something here \033[0m&qu ...

  8. Selenium2学习-020-WebUI自动化实战实例-018-获取浏览器窗口位置大小

    在 UI 自动化测试过程中,每个机器上浏览器的默认大小.默认位置不尽相同,需要截图的时候,页面元素可能显示不完全,因而我们需要知道浏览器的宽度,或者直接在启动浏览器时,设置浏览器的宽度或位置(此文暂不 ...

  9. jquery选择器效率优化问题

    jquery选择器效率优化问题   jquery选择器固然强大,但是使用不当回导致效率问题: 1.要养成将jQuery对象缓存进变量的习惯 //不好的写法 $('#btn').bind("c ...

  10. 在Visual Studio 2015中运行OPENGL

    Starting an OpenGL project in VS 2015 is really easy, thanks to the NupenGL.Core nuget package. Here ...