素数判定
来源:互联网 发布:sql update多条记录 编辑:程序博客网 时间:2024/05/29 02:52
/** Copyright (c) 2016, 安徽大学计算机科学与技术学院* All rights reserved.* 作 者: 杨磊* 完成日期:2016 年 12 月 27 日* 问题描述:判断一个数是不是素数。*/#include<cstdio>#include<iostream>#include<stdlib.h>#include<string.h>#include<algorithm>#include<math.h>using namespace std;int IsPrime(int t){ int i,flag=1; for(i=2;i*i<=t;i++) if(t%i==0) flag=0; return(flag);}int main(){ int a; while(scanf("%d",&a)!=EOF) if(IsPrime(a)) cout<<"Yes"<<endl; else cout<<"No"<<endl;return 0;}
0 0
- 素数判定
- 素数判定
- 素数判定
- 素数判定
- 素数判定
- 素数判定
- 素数判定
- 素数判定
- 素数判定
- 素数判定
- 素数判定
- 素数判定
- 素数判定
- 素数判定
- 素数判定!
- 素数判定
- 素数判定
- 素数判定
- OpenGL光照设置问题
- 数据挖掘十大算法- K-means 算法
- 不用管代码中引入的类直接修改class文件
- Android Studio(AS)中apk的位置
- Servlet源码
- 素数判定
- Unity3D中,Android应用的退出脚本。
- 读论文写论文——MEMORY NETWORKS
- Mail merge region 'tablePrint' is badly formed. TableStart and TableEnd should be in the same sectio
- nginx做web服务器负载均衡
- shader中面的剔除 (cull)
- Unity开发项目应该一开始规划好哪些内容?如何避免后期巨坑?
- 1091. Acute Stroke (30)解题报告
- web 端 gantt组件选型