HDU 2161 Primes 数论
来源:互联网 发布:ubuntu升级16.04后黑屏 编辑:程序博客网 时间:2024/05/17 06:30
题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=2161
需要注意的一点是:在这里1和2不是素数
直接上代码:
#include <iostream>#include <cstdio>#include <cstdlib>#include <cmath>#include <cstring>#include <string>#include <algorithm>#include <vector>#include <set>#include <map>#include <queue>using namespace std;/*freopen("input.txt", "r", stdin); //读数据freopen("output.txt", "w", stdout); //注释掉此句则输出到控制台*/bool isprime(int n){ if(n==1||n==2) return false; for(int i=2;i<=n/2;i++) if(n%i==0) return false; return true;}int main(){ int xiaohao=1,n; while(cin>>n&&n>0) { if(isprime(n)) printf("%d: yes\n",xiaohao++); else printf("%d: no\n",xiaohao++); } return 520;}
- HDU 2161 Primes 数论
- HDU 5901 Count primes【数论】
- hdu 2161 Primes
- hdu-2161-Primes
- hdu 2161 Primes
- Primes HDU 2161
- hdu 2161 Primes
- hdu 2161 Primes
- [HDU 2161] Primes
- hdu 2161 Primes
- hdu 2161 Primes(素数)
- HDU 2161 Primes
- HDU 2161 Primes 判断素数
- HDU 2161 Primes 判断素数
- HDU - 2161 - Primes (质数)
- HDU 2161 Primes
- 2016 ACM/ICPC Asia Regional Shenyang Online HDU 5901 Count Primes (模板 + 数论知识)★
- HDU 2161 Primes(素数打表)
- CToolTipCtrl和SetROP2一起使用冲突
- Windows 下 SVN 服务器配置
- 设计模式之组合模式(Composite)
- poj1218解题报告
- Median 2011年浙大机试
- HDU 2161 Primes 数论
- win7安装svn服务 [sc] openSCManager 失败 5 拒绝 访问拒绝
- MyEclipse中文乱码问题
- 对象析构谈—— delete this 的使用及注意事项
- Spring中@Autowired注解、@Resource注解的区别
- zabbix 自定义监控
- Java mock工具-mockito
- 利用ASIHTTPRequest请求java服务和JSONKit解析返回的json串
- servlet调用spring容器中的bean,的两种方式一种注解一种xml配置