結果

問題 No.8023 素数判定するだけ
ユーザー Mcpu3
提出日時 2019-09-20 22:45:07
言語 Java
(openjdk 23)
結果
AC  
実行時間 141 ms / 1,000 ms
コード長 486 bytes
コンパイル時間 4,558 ms
コンパイル使用メモリ 74,444 KB
実行使用メモリ 54,120 KB
最終ジャッジ日時 2024-09-14 18:49:29
合計ジャッジ時間 9,715 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

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