結果

問題 No.3023 素数判定するだけ
ユーザー 37zigen37zigen
提出日時 2017-03-31 23:00:36
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 700 bytes
コンパイル時間 2,086 ms
コンパイル使用メモリ 73,024 KB
実行使用メモリ 56,240 KB
最終ジャッジ日時 2023-09-21 11:14:47
合計ジャッジ時間 9,413 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,976 KB
testcase_01 AC 127 ms
55,656 KB
testcase_02 WA -
testcase_03 AC 124 ms
55,672 KB
testcase_04 AC 122 ms
55,776 KB
testcase_05 AC 122 ms
55,812 KB
testcase_06 AC 124 ms
55,656 KB
testcase_07 AC 124 ms
55,800 KB
testcase_08 AC 124 ms
55,752 KB
testcase_09 AC 123 ms
56,104 KB
testcase_10 AC 126 ms
56,144 KB
testcase_11 AC 127 ms
55,856 KB
testcase_12 AC 127 ms
55,504 KB
testcase_13 AC 128 ms
55,848 KB
testcase_14 AC 131 ms
55,744 KB
testcase_15 AC 127 ms
55,700 KB
testcase_16 AC 131 ms
56,036 KB
testcase_17 AC 130 ms
56,060 KB
testcase_18 AC 125 ms
55,440 KB
testcase_19 AC 125 ms
56,108 KB
testcase_20 AC 128 ms
55,748 KB
testcase_21 AC 127 ms
55,520 KB
testcase_22 AC 126 ms
55,668 KB
testcase_23 AC 125 ms
56,240 KB
testcase_24 AC 124 ms
55,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		if (N == BigInteger.ZERO.intValue()) {
			System.out.println("NO");
			return;
		}
		for (int i = BigInteger.ONE.add(BigInteger.ONE).intValue(); i < N; i = BigInteger.valueOf(i).add(BigInteger.ONE)
				.intValue()) {
			if (N % i == BigInteger.ZERO.intValue()) {
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}
0