• java判断大素数


    模板:

    大素数判断 java
    2010-06-03 22:22
    import java.io.*;
    import java.util.*;
    import java.math.*;
    public class Main {
    static Scanner in;
    static PrintWriter out;
    public static void main(String[] args) throws Exception {
    in = new Scanner(System.in);
    out = new PrintWriter(System.out);


    int number;
    number = in.nextInt();
    int result[] = new int[number];
    for(int i = 0;i<number;i++)
    {
    BigInteger a;
    a=in.nextBigInteger();
    if(a.isProbablePrime(80)) 
    {
    result[i] = 1;
    //out.println("Prime");
    }
    else 
    {
    result[i] = 0;
    // out.println("Not Prime");
    }
    }

    for(int i = 0;i<number;i++)
    {

    if(result[i] == 0)
    out.println("No");
    else
    out.println("Yes");
    }
    in.close();
    out.close();
    }
    }
    ==================
  • 相关阅读:
    Ztree
    WebAPI
    数据传输
    jqyery+ajax 提交表单
    初试 MVC+Boostrap
    CSV 导入SQL Server 中
    10-C语言循环结构(一)
    Linux测试语句(test)
    C 链表
    C递归
  • 原文地址:https://www.cnblogs.com/yuelingzhi/p/2185461.html
Copyright © 2020-2023  润新知