結果

問題 No.3030 ミラー・ラビン素数判定法のテスト
ユーザー Mcpu3Mcpu3
提出日時 2019-09-20 23:16:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 3,898 ms / 9,973 ms
コード長 453 bytes
コンパイル時間 2,373 ms
コンパイル使用メモリ 76,568 KB
実行使用メモリ 59,000 KB
最終ジャッジ日時 2024-04-28 09:25:10
合計ジャッジ時間 15,852 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
40,540 KB
testcase_01 AC 112 ms
41,208 KB
testcase_02 AC 132 ms
41,660 KB
testcase_03 AC 148 ms
41,632 KB
testcase_04 AC 2,602 ms
57,988 KB
testcase_05 AC 3,033 ms
58,452 KB
testcase_06 AC 1,116 ms
55,152 KB
testcase_07 AC 1,028 ms
54,872 KB
testcase_08 AC 1,041 ms
54,828 KB
testcase_09 AC 3,898 ms
59,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.BigInteger;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		for (int i = 0; i < n; ++i) {
			BigInteger x = scanner.nextBigInteger();
			System.out.print(x + " ");
			if (x.isProbablePrime(Integer.MAX_VALUE)) System.out.print(1);
			else System.out.print(0);
			System.out.println();
		}
		scanner.close();
	}
}
0