51nod-1186 质数检测
来源:互联网 发布:淘宝店铺转让升级企业 编辑:程序博客网 时间:2024/05/16 01:34
原题链接
1186 质数检测 V2
基准时间限制:1 秒 空间限制:131072 KB 分值: 40 难度:4级算法题
收藏
关注
给出1个正整数N,检测N是否为质数。如果是,输出"Yes",否则输出"No"。
Input
输入一个数N(2 <= N <= 10^30)
Output
如果N为质数,输出"Yes",否则输出"No"。
Input示例
17
Output示例
Yes
boolean isPrime=aBigInteger.isprobablePrime(alpha);
//false: this BigInteger is 100% not prime
//true: this BigInteger may be a prime, the probability is larger
//than (1-1/20)=95%.
//the larger the alpha, the longer the calculation time will be.
import java.util.*;import java.math.*;public class TEST { public static void main(String args[]){Scanner cin = new Scanner(System.in);while(cin.hasNext()){BigInteger m = cin.nextBigInteger();if(m.isProbablePrime(1)){System.out.println("Yes");}else{System.out.println("No");}}}}
0 0
- 51nod-1186 质数检测
- 51nod 1186 质数检测 V2
- 51nod 1186 质数检测 V2
- 51Nod 1186 质数检测 V2
- 51nod 1106 质数检测
- 51nod 1106 质数检测
- 51nod-1106质数检测
- 51nod 1106 质数检测
- 51nod-【1106 质数检测】
- 51NOD 1106质数检测
- 51Nod 1106 质数检测
- 【51Nod】1106 质数检测
- 51Nod-1106-质数检测
- 51Nod 1106 质数检测
- 51Nod-1106 质数检测
- 51 Nod 1106 质数检测
- 51nod 1106 质数检测
- 【51nod】1106 质数检测
- 华为上机题汇总(十六)
- Java技能树
- JMeter入门8---集合点
- JS 工具博客
- System.getProperty()方法大全
- 51nod-1186 质数检测
- 使用runloop阻塞线程
- JMeter入门7---监控服务器CPU, 内存,网络数据
- 关于Django出现Specified key was too long; max key length is 767 bytes的解决办法
- SystemClock
- 【Android】使用OpenCV提取人体肤色区域
- 【Qt开发】Linux下Qt开发环境的安装与集成
- com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/NOTICE
- fidder抓包