結果

問題 No.3023 素数判定するだけ
ユーザー Mcpu3Mcpu3
提出日時 2019-09-20 22:48:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 1,000 ms
コード長 486 bytes
コンパイル時間 2,195 ms
コンパイル使用メモリ 71,780 KB
実行使用メモリ 56,140 KB
最終ジャッジ日時 2023-10-12 20:34:52
合計ジャッジ時間 9,505 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,796 KB
testcase_01 AC 126 ms
55,636 KB
testcase_02 AC 124 ms
55,668 KB
testcase_03 AC 126 ms
55,724 KB
testcase_04 AC 126 ms
55,584 KB
testcase_05 AC 129 ms
55,768 KB
testcase_06 AC 127 ms
55,620 KB
testcase_07 AC 127 ms
55,864 KB
testcase_08 AC 128 ms
56,084 KB
testcase_09 AC 126 ms
55,508 KB
testcase_10 AC 126 ms
56,140 KB
testcase_11 AC 125 ms
55,708 KB
testcase_12 AC 125 ms
55,668 KB
testcase_13 AC 125 ms
55,772 KB
testcase_14 AC 134 ms
55,860 KB
testcase_15 AC 127 ms
55,860 KB
testcase_16 AC 130 ms
55,916 KB
testcase_17 AC 132 ms
55,748 KB
testcase_18 AC 126 ms
55,748 KB
testcase_19 AC 124 ms
55,724 KB
testcase_20 AC 127 ms
55,860 KB
testcase_21 AC 128 ms
55,928 KB
testcase_22 AC 129 ms
55,808 KB
testcase_23 AC 127 ms
55,428 KB
testcase_24 AC 127 ms
55,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Main {
	public static void main(String[] agrs) {
		Scanner scanner = new Scanner(System.in);
		BigInteger N = scanner.nextBigInteger(), i;
		scanner.close();
		for (i = BigInteger.ONE.add(BigInteger.ONE); BigInteger.ONE.intValue() == N.compareTo(i); i = BigInteger.ONE.add(i)) {
			if (BigInteger.ZERO.equals(N.mod(i))) break;
		}
		if (N.equals(i)) System.out.print("YES");
		else System.out.print("NO");
	}
}
0