結果

問題 No.8023 素数判定するだけ
コンテスト
ユーザー uwi
提出日時 2017-03-31 22:39:40
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
AC  
実行時間 69 ms / 1,000 ms
コード長 1,123 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,757 ms
コンパイル使用メモリ 84,416 KB
実行使用メモリ 43,224 KB
最終ジャッジ日時 2026-04-20 13:26:08
合計ジャッジ時間 6,932 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.math.BigInteger;
import java.util.Scanner;

public class EE {
	static Scanner in;
	static PrintWriter out;
	static String INPUT = "";
	
	static void solve()
	{
		int n = ni();
		BigInteger N = BigInteger.valueOf(n);
		for(Method m : BigInteger.class.getMethods()){
			if(m.getName().startsWith("isP")){
				try {
					if((Boolean)m.invoke(N, BigInteger.TEN.intValue())){
						out.println("YES");
					}else{
						out.println("NO");
					}
				} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException
						| SecurityException e) {
					e.printStackTrace();
				}
				break;
			}
		}
	}
	
	public static void main(String[] args) throws Exception
	{
		in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);
		out = new PrintWriter(System.out);
		
		solve();
		out.flush();
	}
	
	static int ni() { return Integer.parseInt(in.next()); }
	static long nl() { return Long.parseLong(in.next()); }
	static double nd() { return Double.parseDouble(in.next()); }
}
0