結果
問題 | No.8023 素数判定するだけ |
ユーザー |
![]() |
提出日時 | 2017-03-31 22:44:00 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 127 ms / 1,000 ms |
コード長 | 616 bytes |
コンパイル時間 | 1,748 ms |
コンパイル使用メモリ | 74,604 KB |
実行使用メモリ | 54,364 KB |
最終ジャッジ日時 | 2024-10-04 19:54:31 |
合計ジャッジ時間 | 7,761 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
import java.math.BigInteger; import java.util.Scanner; public class Main{ static Scanner s=new Scanner(System.in); public static void main(String __[]){ input(); solve(s.nextInt()); } private static void input(){ } private static void solve(int in){ BigInteger inb=BigInteger.valueOf(in); if(inb.equals(BigInteger.ONE)){ System.out.println("NO"); return; } for(BigInteger bi=BigInteger.ONE.add(BigInteger.ONE); bi.intValue()<in; bi=bi.add(BigInteger.ONE)){ if(inb.mod(bi).equals(BigInteger.ZERO)) { System.out.println("NO"); return; } } System.out.println("YES"); } }