結果

問題 No.308 素数は通れません
ユーザー NekosyndromeNekosyndrome
提出日時 2015-12-12 03:37:16
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 587 bytes
コンパイル時間 1,986 ms
コンパイル使用メモリ 71,288 KB
実行使用メモリ 58,244 KB
最終ジャッジ日時 2023-10-13 11:37:56
合計ジャッジ時間 19,530 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
53,548 KB
testcase_01 AC 124 ms
55,588 KB
testcase_02 AC 127 ms
55,588 KB
testcase_03 AC 125 ms
55,712 KB
testcase_04 AC 125 ms
55,944 KB
testcase_05 AC 126 ms
55,932 KB
testcase_06 AC 125 ms
55,584 KB
testcase_07 AC 126 ms
56,172 KB
testcase_08 AC 126 ms
55,860 KB
testcase_09 AC 126 ms
55,892 KB
testcase_10 AC 127 ms
57,616 KB
testcase_11 AC 126 ms
55,532 KB
testcase_12 AC 126 ms
55,492 KB
testcase_13 AC 125 ms
55,720 KB
testcase_14 AC 126 ms
55,956 KB
testcase_15 AC 126 ms
56,012 KB
testcase_16 WA -
testcase_17 AC 125 ms
55,792 KB
testcase_18 AC 127 ms
55,692 KB
testcase_19 AC 127 ms
55,580 KB
testcase_20 AC 128 ms
55,756 KB
testcase_21 AC 128 ms
55,936 KB
testcase_22 AC 126 ms
55,384 KB
testcase_23 AC 125 ms
55,960 KB
testcase_24 AC 126 ms
55,684 KB
testcase_25 WA -
testcase_26 AC 126 ms
56,088 KB
testcase_27 AC 127 ms
55,996 KB
testcase_28 AC 127 ms
56,096 KB
testcase_29 WA -
testcase_30 AC 127 ms
56,156 KB
testcase_31 AC 125 ms
55,880 KB
testcase_32 WA -
testcase_33 AC 125 ms
55,908 KB
testcase_34 WA -
testcase_35 AC 124 ms
55,968 KB
testcase_36 AC 124 ms
55,720 KB
testcase_37 AC 124 ms
56,068 KB
testcase_38 AC 125 ms
55,792 KB
testcase_39 AC 125 ms
55,816 KB
testcase_40 AC 125 ms
55,652 KB
testcase_41 AC 127 ms
56,176 KB
testcase_42 AC 126 ms
56,328 KB
testcase_43 AC 126 ms
55,944 KB
testcase_44 AC 125 ms
55,776 KB
testcase_45 AC 126 ms
56,188 KB
testcase_46 AC 125 ms
55,452 KB
testcase_47 AC 125 ms
55,808 KB
testcase_48 AC 128 ms
55,660 KB
testcase_49 AC 125 ms
55,992 KB
testcase_50 AC 126 ms
56,116 KB
testcase_51 AC 125 ms
55,932 KB
testcase_52 AC 125 ms
53,964 KB
testcase_53 AC 126 ms
55,740 KB
testcase_54 WA -
testcase_55 WA -
testcase_56 AC 126 ms
55,964 KB
testcase_57 AC 125 ms
55,948 KB
testcase_58 AC 127 ms
55,632 KB
testcase_59 AC 125 ms
55,848 KB
testcase_60 AC 125 ms
55,620 KB
testcase_61 AC 126 ms
56,188 KB
testcase_62 AC 127 ms
55,856 KB
testcase_63 AC 127 ms
56,124 KB
testcase_64 AC 127 ms
56,012 KB
testcase_65 AC 128 ms
55,568 KB
testcase_66 AC 126 ms
55,888 KB
testcase_67 AC 126 ms
55,868 KB
testcase_68 AC 125 ms
56,036 KB
testcase_69 AC 127 ms
55,876 KB
testcase_70 AC 125 ms
55,692 KB
testcase_71 AC 129 ms
57,292 KB
testcase_72 AC 127 ms
56,352 KB
testcase_73 AC 126 ms
55,636 KB
testcase_74 AC 129 ms
56,356 KB
testcase_75 AC 127 ms
55,880 KB
testcase_76 WA -
testcase_77 WA -
testcase_78 WA -
testcase_79 WA -
testcase_80 WA -
testcase_81 WA -
testcase_82 WA -
testcase_83 WA -
testcase_84 WA -
testcase_85 WA -
testcase_86 WA -
testcase_87 WA -
testcase_88 WA -
testcase_89 WA -
testcase_90 WA -
testcase_91 WA -
testcase_92 WA -
testcase_93 WA -
testcase_94 WA -
testcase_95 WA -
testcase_96 AC 125 ms
55,888 KB
testcase_97 AC 124 ms
55,508 KB
testcase_98 AC 124 ms
56,152 KB
testcase_99 AC 125 ms
53,944 KB
testcase_100 AC 124 ms
56,324 KB
testcase_101 WA -
testcase_102 WA -
testcase_103 AC 127 ms
55,944 KB
testcase_104 AC 126 ms
55,688 KB
testcase_105 AC 130 ms
56,228 KB
testcase_106 AC 128 ms
55,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;

class main
{
	public static BigInteger trans(int x)
	{
		return BigInteger.valueOf(x);
	}
	public static void main(String[] args)
	{
		int []ans={-1,-1,-1,-1,3,-1,5,-1,7,7,7,-1,11,-1,13,7,7,-1,8,-1,19,19,7,-1,23,23};
		Scanner sc = new Scanner(System.in);
		BigInteger n = sc.nextBigInteger();

		if(n.compareTo( trans(25) )<=0)
			System.out.println(ans[n.intValue()]);
		else
		{
			if( n.mod(trans(8)).compareTo(trans(1))==1 && n.subtract(trans(8)).isProbablePrime(20) )
				System.out.println(14);
			else
				System.out.println(8);
		}
	}
}
0