51Nod-1186-质数检测 V2 JAVA biginteger包

来源:互联网 发布:在哪买淘宝号 编辑:程序博客网 时间:2024/06/07 08:22



输入已经是大数  C++需要高精度   这里用JAVA 简单一点 直接操作。


import java.math.BigInteger;import java.util.Scanner;public  class Main {public static void main(String[] args) {// TODO Auto-generated method stubScanner in = new Scanner(System.in );BigInteger x;x = in.nextBigInteger();if(x.isProbablePrime(1)){System.out.println("Yes");}else{System.out.println("No");}}}


原创粉丝点击