本文整理汇总了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");
}
示例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());
}
示例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());
}
}
示例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);
}
示例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");
}