51nod-1106质数检测
2016-09-12 11:20
211 查看
正常判断检测。
#include <iostream> #include <stdio.h> using namespace std; int judge(int n) { for(int i=2;i*i<=n;i++) { if(n%i==0) { return 0; } } return 1; } int main() { int n,t; cin>>n; while(n--) { cin>>t; if(judge(t)) cout<<"YES"<<endl; else cout<<"NO"<<endl; } return 0; }
相关文章推荐
- 51Nod-1106-质数检测
- 20140915 【 数论 - Miller_Rabin素数测试 】 51nod 1106 . 质数检测
- 51nod 1106 质数检测
- 51nod_1106 质数检测
- 51Nod-1106-质数检测
- 51nod 1106 质数检测
- 51nod 1106 质数检测
- 51nod 1106 质数检测 (三种模板_好题)
- 51Nod 1106 质数检测
- 51nod 1106 质数检测(miller rabin 素数测试.)
- 51nod-【1106 质数检测】
- 51Nod-1106 质数检测
- 51nod 1106 质数检测
- 51Nod 1106 质数检测
- 【51nod】1106 质数检测
- 【51nod】1106 质数检测 埃拉托斯特尼筛法
- 51nod 1106 质数检测——Mr判素数
- 【51NOD-0】1106 质数检测
- 51nod 1106 质数检测
- 【51Nod】1106 质数检测