結果

問題 No.3023 素数判定するだけ
ユーザー uwiuwi
提出日時 2017-03-31 22:39:40
言語 Java21
(openjdk 21)
結果
AC  
実行時間 141 ms / 1,000 ms
コード長 1,123 bytes
コンパイル時間 3,819 ms
コンパイル使用メモリ 81,936 KB
実行使用メモリ 55,268 KB
最終ジャッジ日時 2024-04-15 06:20:46
合計ジャッジ時間 9,899 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
54,892 KB
testcase_01 AC 136 ms
55,260 KB
testcase_02 AC 134 ms
54,980 KB
testcase_03 AC 135 ms
55,180 KB
testcase_04 AC 141 ms
55,268 KB
testcase_05 AC 139 ms
55,160 KB
testcase_06 AC 129 ms
55,160 KB
testcase_07 AC 137 ms
54,992 KB
testcase_08 AC 127 ms
54,772 KB
testcase_09 AC 126 ms
54,744 KB
testcase_10 AC 127 ms
54,728 KB
testcase_11 AC 136 ms
55,120 KB
testcase_12 AC 127 ms
54,896 KB
testcase_13 AC 138 ms
54,864 KB
testcase_14 AC 126 ms
54,752 KB
testcase_15 AC 140 ms
55,040 KB
testcase_16 AC 138 ms
55,104 KB
testcase_17 AC 129 ms
54,680 KB
testcase_18 AC 127 ms
54,780 KB
testcase_19 AC 129 ms
54,584 KB
testcase_20 AC 125 ms
54,864 KB
testcase_21 AC 140 ms
54,916 KB
testcase_22 AC 127 ms
54,848 KB
testcase_23 AC 126 ms
54,892 KB
testcase_24 AC 138 ms
55,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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