結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,816 KB
testcase_01 AC 128 ms
55,800 KB
testcase_02 AC 127 ms
55,700 KB
testcase_03 AC 127 ms
55,748 KB
testcase_04 AC 126 ms
55,852 KB
testcase_05 AC 128 ms
55,912 KB
testcase_06 AC 125 ms
55,724 KB
testcase_07 AC 126 ms
55,760 KB
testcase_08 AC 128 ms
55,348 KB
testcase_09 AC 128 ms
55,816 KB
testcase_10 AC 127 ms
55,928 KB
testcase_11 AC 126 ms
55,516 KB
testcase_12 AC 126 ms
55,932 KB
testcase_13 AC 127 ms
55,612 KB
testcase_14 AC 134 ms
55,732 KB
testcase_15 AC 127 ms
55,844 KB
testcase_16 AC 132 ms
55,560 KB
testcase_17 AC 134 ms
56,144 KB
testcase_18 AC 127 ms
56,128 KB
testcase_19 AC 126 ms
55,624 KB
testcase_20 AC 127 ms
55,628 KB
testcase_21 AC 127 ms
56,036 KB
testcase_22 AC 128 ms
55,592 KB
testcase_23 AC 128 ms
55,792 KB
testcase_24 AC 127 ms
55,724 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 = i.add(BigInteger.ONE)) {
			if (BigInteger.ZERO.equals(N.mod(i))) break;
		}
		if (N.equals(i)) System.out.print("YES");
		else System.out.print("NO");
	}
}
0