HDU2161
解题思路:判断素数模板题。
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn = ;
int vis[maxn]; void Init()
{
memset(vis, , sizeof(vis));
vis[] = ;
for(int i = ; i <= maxn; i++)
{
for(int j = i+i; j <= maxn; j +=i)
vis[j] = ;
}
return ;
}
int main()
{
Init();
int n, kase = ;
while(~scanf("%d", &n))
{
if(n <= ) break;
if(n == || n == )
{
printf("%d: no\n", kase++);
continue;
}
if(!vis[n]) printf("%d: yes\n", kase++);
else printf("%d: no\n", kase++);
}
return ;
}
HDU2161的更多相关文章
- HDU2161 Primes
/* HDU2161 Primes http://acm.hdu.edu.cn/showproblem.php?pid=2161 数论 水题 注意输入截止条件是n<=0 */ #include ...
- OJ题目分类
POJ题目分类 | POJ题目分类 | HDU题目分类 | ZOJ题目分类 | SOJ题目分类 | HOJ题目分类 | FOJ题目分类 | 模拟题: POJ1006 POJ1008 POJ1013 P ...
随机推荐
- The OAuth 2.0 Authorization Framework: Bearer Token Usage
https://tools.ietf.org/html/rfc6750 1.2. Terminology Bearer Token A security token with the property ...
- poj3299 - Humidex
2017-08-31 19:08:25 writer:pprp 水题: 没有技术含量hhh 但是,还是花了很长时间,以后水题也是很有必要练习的 /* @theme:poj 3299 @writer:p ...
- 随笔分类 - java高级特性
转自:http://www.cnblogs.com/linjiqin/category/282013.html
- Visual Studio 2010 C++ 属性设置基础
在 <Visual Studio 2010 C++ 工程文件解读>中提到了C++工程中可以进行用户自定义的属性设置,如何进行属性设置呢? 下面我们来了解一下 props 文件的基本规则: ...
- 检签 sub sup应用
<html> <body> <b>This text is bold</b> <br /> <strong>This text ...
- Oracle中 如何用一个表的数据更新另一个表中的数据
准备阶段 1.建表语句: create table table1( idd varchar2(10) , val varchar2(20) ); create table table2( idd va ...
- 清理网页中的HTML
public string ClearHtml(string text)//过滤html,js,css代码 { text = text.Trim(); if (string.IsNullOrEmpty ...
- mysql中一个字段根据另一字段的值分割为不同列
1.数据结构如下: vehicleId mileage_type mileage 11AM6897 0 120 11AM6897 1 60 13AY9180 0 ...
- Struts2的Convention插件
Struts2的Convention插件的作用:在Struts2中的/lib/struts2-convention-plugin-x.x.xx.x.jar Convention插件会自动搜索位于act ...
- OGNL表达式语言中的"#"和"$"的区别
Struts2使用标准的Context来进行OGNL表达式语言求值,OGNL的顶级对象是一个Context,这个Context对象就是一个Map类型实例,其根对象就是ValueStack,如果需要访问 ...