當前位置: 首頁>>代碼示例>>Java>>正文


Java Scanner.nextBigInteger方法代碼示例

本文整理匯總了Java中java.util.Scanner.nextBigInteger方法的典型用法代碼示例。如果您正苦於以下問題:Java Scanner.nextBigInteger方法的具體用法?Java Scanner.nextBigInteger怎麽用?Java Scanner.nextBigInteger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.Scanner的用法示例。


在下文中一共展示了Scanner.nextBigInteger方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import java.util.Scanner; //導入方法依賴的package包/類
public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    BigInteger n = in.nextBigInteger();
    in.close();

    System.out.println(n.isProbablePrime(1) ? "prime" : "not prime");
}
 
開發者ID:viatsko,項目名稱:hack,代碼行數:8,代碼來源:JavaPrimalityTest.java

示例2: main

import java.util.Scanner; //導入方法依賴的package包/類
public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    BigInteger a = sc.nextBigInteger();
    BigInteger b = sc.nextBigInteger();
    BigInteger c = sc.nextBigInteger();

    BigInteger ans = a.modPow(b, c);

    System.out.println(ans.toString());
}
 
開發者ID:mayuanucas,項目名稱:51nod,代碼行數:12,代碼來源:Solution.java

示例3: main

import java.util.Scanner; //導入方法依賴的package包/類
public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    while (sc.hasNext()){
        BigInteger a = sc.nextBigInteger();
        BigInteger b = sc.nextBigInteger();
        System.out.println(a.add(b).toString());
    }
}
 
開發者ID:mayuanucas,項目名稱:51nod,代碼行數:9,代碼來源:Solution.java

示例4: main

import java.util.Scanner; //導入方法依賴的package包/類
public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int numOfPeople = scanner.nextInt();
    int numOfTopics = scanner.nextInt();
    BigInteger[] familiarity = new BigInteger[numOfPeople];
    int maxBitCount = 0;
    int maxScoreCount = 0;
    BigInteger score;

    for(int i=0; i<numOfPeople; i++) {
        familiarity[i] = scanner.nextBigInteger(2);
    }

    for(int i=0; i<familiarity.length-1; i++) {
        for(int j=i+1; j<=familiarity.length-1; j++) {
            score = familiarity[i].or(familiarity[j]);
            int bitCount = score.bitCount();
            if(bitCount > maxBitCount) {
                maxBitCount = bitCount;
                maxScoreCount = 1;
            } else if(bitCount == maxBitCount) {
                maxScoreCount++;
            }
        }
    }
    System.out.println(maxBitCount);
    System.out.println(maxScoreCount);
}
 
開發者ID:hell-sing,項目名稱:hacker-rank,代碼行數:29,代碼來源:ACM_ICPC_Team.java

示例5: main

import java.util.Scanner; //導入方法依賴的package包/類
public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    BigInteger n = scan.nextBigInteger();
    scan.close();
    System.out.println(n.isProbablePrime(10) ? "prime" : "not prime");
}
 
開發者ID:rshaghoulian,項目名稱:HackerRank_solutions,代碼行數:7,代碼來源:Solution.java


注:本文中的java.util.Scanner.nextBigInteger方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。