結果
| 問題 | No.8023 素数判定するだけ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-03-31 22:46:59 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 696 bytes |
| 記録 | |
| コンパイル時間 | 1,565 ms |
| コンパイル使用メモリ | 82,576 KB |
| 実行使用メモリ | 43,304 KB |
| 最終ジャッジ日時 | 2026-03-28 19:40:23 |
| 合計ジャッジ時間 | 5,711 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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");
}
}