結果
問題 |
No.8023 素数判定するだけ
|
ユーザー |
|
提出日時 | 2017-03-31 23:01:38 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 123 ms / 1,000 ms |
コード長 | 699 bytes |
コンパイル時間 | 1,800 ms |
コンパイル使用メモリ | 75,396 KB |
実行使用メモリ | 54,212 KB |
最終ジャッジ日時 | 2024-10-04 20:01:41 |
合計ジャッジ時間 | 7,953 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
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.ONE.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)); } }