結果
問題 |
No.8023 素数判定するだけ
|
ユーザー |
|
提出日時 | 2017-03-31 22:46:59 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 696 bytes |
コンパイル時間 | 2,340 ms |
コンパイル使用メモリ | 74,656 KB |
実行使用メモリ | 56,000 KB |
最終ジャッジ日時 | 2024-07-07 05:02:35 |
合計ジャッジ時間 | 9,596 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 25 |
ソースコード
import java.io.*; import java.lang.*; import java.util.*; import java.math.*; public class Main { static Scanner cin = new Scanner(System.in); public static void main(String[] args) { BigInteger n = new BigInteger(cin.next()); BigInteger i = BigInteger.ONE; i=i.add(BigInteger.ONE); BigInteger f = BigInteger.ONE; if(n.equals(BigInteger.ONE)) f=BigInteger.ZERO; for(;; i=i.add(BigInteger.ONE)) { if(i.equals(n)||f.equals(BigInteger.ZERO)) break; if(n.mod(i)==BigInteger.ZERO) f=BigInteger.ZERO; } if(f.equals(BigInteger.ONE)) System.out.println("YES"); else System.out.println("NO"); } }