結果

問題 No.8023 素数判定するだけ
ユーザー 37zigen
提出日時 2017-03-31 23:00:36
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 700 bytes
コンパイル時間 2,015 ms
コンパイル使用メモリ 75,172 KB
実行使用メモリ 54,548 KB
最終ジャッジ日時 2024-07-07 05:12:54
合計ジャッジ時間 7,724 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 1
権限があれば一括ダウンロードができます

ソースコード

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