/*
HDU2161 Primes
http://acm.hdu.edu.cn/showproblem.php?pid=2161
数论 水题
注意输入截止条件是n<=0
*/
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
//#define test
using namespace std;
const int Nmax=;
int is_prime[Nmax];
void get()
{
for(int i=;i<Nmax;i++)
is_prime[i]=;
for(int i=;i<Nmax;i++)
{
if(is_prime[i])
{
for(int j=;j*i<Nmax;j++)
is_prime[i*j]=;
}
}
is_prime[]=;
}
int main()
{
#ifdef test
#endif
int n,t=;
get();
while(scanf("%d",&n)==)
{
if(n<=)
break;
t++;
printf("%d: ",t);
if(is_prime[n])
printf("yes\n");
else
printf("no\n");
} return ;
}

HDU2161 Primes的更多相关文章

  1. [LeetCode] Count Primes 质数的个数

    Description: Count the number of prime numbers less than a non-negative number, n click to show more ...

  2. projecteuler Summation of primes

    The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two milli ...

  3. leetcode-Count Primes 以及python的小特性

    题目大家都非常熟悉,求小于n的所有素数的个数. 自己写的python 代码老是通不过时间门槛,无奈去看了看大家写的code.下面是我看到的投票最高的code: class Solution: # @p ...

  4. Count Primes - LeetCode

    examination questions Description: Count the number of prime numbers less than a non-negative number ...

  5. [leetcode] Count Primes

    Count Primes Description: Count the number of prime numbers less than a non-negative number, n click ...

  6. Count Primes

    Count the number of prime numbers less than a non-negative number, n public int countPrimes(int n) { ...

  7. hduoj 4715 Difference Between Primes 2013 ACM/ICPC Asia Regional Online —— Warmup

    http://acm.hdu.edu.cn/showproblem.php?pid=4715 Difference Between Primes Time Limit: 2000/1000 MS (J ...

  8. HDU 4715:Difference Between Primes

    Difference Between Primes Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Jav ...

  9. hdu 4715 Difference Between Primes

    题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4715 Difference Between Primes Description All you kn ...

随机推荐

  1. sql格式化日期

    SELECT CONVERT(date, GETDATE()) ---- SELECT CONVERT(varchar(), GETDATE(), ) ----

  2. 【cl】sikuli下载安装

    前提条件: 1.请确保你已经安装java 6 JRE 32位版本(如果是java 7 或者是64位JRE 那是不被支持的) 2.请确定你已经卸载的先前的sikuli版本(尤其是0.10.x版本) 3. ...

  3. dwr异常处理

    配置异常转换器: dwr.xml: <!-- 异常转换 --> <convert match="java.lang.Exception" converter=&q ...

  4. 【NOIP 2009】 靶形数独

    [题目链接] https://www.luogu.org/problemnew/show/P1074 [算法] 搜索 + 剪枝 [代码] #include<bits/stdc++.h> u ...

  5. BZOJ 3992 DP+NTT+快速幂

    思路: 普通的DP很好想吧 f[i][j]+=f[i-1][j*s[k]]  前i个数  mod m=j 的个数 m是质数  模数是质数  这就很有趣了 那么我们就求出来原根  所有的数都取指数 搞出 ...

  6. Delete, drop table, truncate之间的区别

    Delete, drop table, truncate有什么区别? delete 删除表中数据,可以删除一条或多条记录,可以回滚,记录操作日记,是DML truncate table,一次性清空表中 ...

  7. Educational Codeforces Round 33

    # Who = Penalty * A B C D E F 479 arkethos 4 247   + 00:08 + 00:19 +1 00:59 +2 01:41     479  ne-leo ...

  8. 【Oracle】DBMS_STATS.GATHER_TABLE_STATS分析表

    表分析,简单的说,就是收集表和索引的信息,CBO根据这些信息决定SQL最佳的执行路径.通过对表的分析,可以产生一些统计信息,通过这些信息oracle的优化程序可以进行优化. 语法: DBMS_STAT ...

  9. Eigen库对齐问题:declspec(align('16')) 的形参将不被对齐

    一:错误提示:error C2719: '_Val': formal parameter with __declspec(align('16')) won't be aligned 英文提示:erro ...

  10. 开发一个 App 有多难?说出来你可能不信!

    上图为程序员客栈儿童类视频APP 1.开发一个APP有多难?说实话,单纯地从开发来说,开发一个APP没有那么难.如果一款APP的基本功能点确定了,开发时间一般为1-2个月就完成了,费用大约5-10万的 ...