結果

問題 No.308 素数は通れません
ユーザー shimomireshimomire
提出日時 2015-12-01 01:19:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,714 bytes
コンパイル時間 389 ms
コンパイル使用メモリ 10,912 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2023-10-12 06:34:23
合計ジャッジ時間 6,960 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,848 KB
testcase_01 AC 16 ms
7,788 KB
testcase_02 AC 16 ms
7,944 KB
testcase_03 AC 16 ms
7,800 KB
testcase_04 AC 16 ms
7,916 KB
testcase_05 AC 16 ms
7,868 KB
testcase_06 AC 16 ms
7,860 KB
testcase_07 AC 16 ms
8,000 KB
testcase_08 AC 16 ms
7,828 KB
testcase_09 WA -
testcase_10 AC 16 ms
7,804 KB
testcase_11 AC 16 ms
7,804 KB
testcase_12 AC 16 ms
7,820 KB
testcase_13 AC 16 ms
7,988 KB
testcase_14 AC 16 ms
7,820 KB
testcase_15 AC 16 ms
7,824 KB
testcase_16 AC 16 ms
7,896 KB
testcase_17 AC 16 ms
7,996 KB
testcase_18 AC 16 ms
7,848 KB
testcase_19 AC 16 ms
7,820 KB
testcase_20 AC 16 ms
7,828 KB
testcase_21 AC 16 ms
7,804 KB
testcase_22 AC 16 ms
7,936 KB
testcase_23 AC 16 ms
7,800 KB
testcase_24 AC 16 ms
7,816 KB
testcase_25 AC 16 ms
7,940 KB
testcase_26 AC 16 ms
7,804 KB
testcase_27 AC 16 ms
7,824 KB
testcase_28 AC 16 ms
7,876 KB
testcase_29 AC 16 ms
7,824 KB
testcase_30 AC 16 ms
7,820 KB
testcase_31 AC 16 ms
7,940 KB
testcase_32 WA -
testcase_33 AC 16 ms
7,832 KB
testcase_34 AC 16 ms
7,876 KB
testcase_35 AC 16 ms
7,948 KB
testcase_36 AC 16 ms
7,896 KB
testcase_37 AC 16 ms
7,752 KB
testcase_38 AC 16 ms
7,788 KB
testcase_39 AC 16 ms
7,832 KB
testcase_40 AC 17 ms
7,844 KB
testcase_41 AC 16 ms
7,800 KB
testcase_42 AC 16 ms
7,872 KB
testcase_43 AC 16 ms
7,872 KB
testcase_44 AC 15 ms
7,748 KB
testcase_45 AC 16 ms
7,892 KB
testcase_46 AC 16 ms
7,820 KB
testcase_47 AC 16 ms
7,848 KB
testcase_48 AC 16 ms
7,832 KB
testcase_49 AC 15 ms
7,832 KB
testcase_50 AC 16 ms
7,940 KB
testcase_51 AC 16 ms
7,944 KB
testcase_52 AC 16 ms
7,828 KB
testcase_53 AC 16 ms
7,804 KB
testcase_54 AC 15 ms
7,752 KB
testcase_55 AC 16 ms
7,896 KB
testcase_56 AC 16 ms
7,820 KB
testcase_57 AC 16 ms
7,940 KB
testcase_58 AC 16 ms
7,848 KB
testcase_59 AC 16 ms
7,808 KB
testcase_60 AC 16 ms
7,804 KB
testcase_61 AC 16 ms
7,860 KB
testcase_62 AC 16 ms
7,832 KB
testcase_63 AC 16 ms
7,748 KB
testcase_64 AC 16 ms
8,004 KB
testcase_65 AC 16 ms
7,868 KB
testcase_66 AC 16 ms
7,884 KB
testcase_67 AC 16 ms
7,820 KB
testcase_68 AC 16 ms
7,800 KB
testcase_69 AC 16 ms
7,832 KB
testcase_70 AC 16 ms
7,868 KB
testcase_71 AC 16 ms
7,868 KB
testcase_72 AC 16 ms
7,884 KB
testcase_73 AC 16 ms
7,820 KB
testcase_74 AC 16 ms
7,816 KB
testcase_75 AC 16 ms
7,944 KB
testcase_76 WA -
testcase_77 AC 16 ms
7,792 KB
testcase_78 AC 16 ms
7,876 KB
testcase_79 AC 16 ms
7,832 KB
testcase_80 WA -
testcase_81 WA -
testcase_82 AC 17 ms
7,792 KB
testcase_83 AC 16 ms
7,836 KB
testcase_84 WA -
testcase_85 AC 16 ms
7,940 KB
testcase_86 TLE -
testcase_87 -- -
testcase_88 -- -
testcase_89 -- -
testcase_90 -- -
testcase_91 -- -
testcase_92 -- -
testcase_93 -- -
testcase_94 -- -
testcase_95 -- -
testcase_96 -- -
testcase_97 -- -
testcase_98 -- -
testcase_99 -- -
testcase_100 -- -
testcase_101 -- -
testcase_102 -- -
testcase_103 -- -
testcase_104 -- -
testcase_105 -- -
testcase_106 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# W = 2
#   1  x2
#  x3

# W = 3
#   1  x2  x3
#   4  x5
#  x7

# W = 4
#   1  x2
#  x5

# W = 5
#   1  x2
#   6  x7
# x11

# W = 6
#   1  x2
#  x7

# W = 7
#   1  x2  x3
#   8   9  10 x11
#  15  16 x17
#  22 x23
# x29 

# W = 8
#   1  x2  x3   4  x5   6  x7   8
#   9  10 x11  12 x13  14  15  16
# x17  18 x19  20  21  22 x23  24
# !25  26  27  28 x29  30 x31  32
# x33  34  35  36 x37  38 x39  40
# x41  42 x43  44  45  46 x47  48
# !49  ..........................

# W = 9
#   1  x2  x3
#  10 x11
# x19

# W = 11
#   1  x2
#  12 x13
# x23

# W = 13
#   1  x2  x3
#  14  15  16 x17
#  27  28 x29
#  40 x41
# x53

# W = 14
#   1  x2  x3   4  x5   6  x7   8   9  10 x11  12 x13  14
#  15  16 x17  18 x19  20  21  22 x23  24  25  26  27  28
# x29  30 x31  32 x33  34  35  36 x37  38 x39  40 x41  42
# x43  44  45  46 x47  48  49  50  51  52 x53  54  55  56
#  57  58 x59  60 x61  62  63  64  65  66 x67  68  69  70
# x71  72 x73  74  75  76  77  78 x79  80  81  82 x83  84

# W = 15
#   1  x2  x3
#  16 x17
# x31



def is_prime(N):
    p = 2
    while p*p <=N:
        if N%p == 0:
            return False
        p = p + 1
    return True

def run(N) :
    if N > 25 and not (N%8 == 1 and is_prime(N-8)): 
        return 8
    # N = 4,6,8,9,10,12,14,15,16,18,20,21,22,24,25
    if N == 4 :
        return 3
    if N == 6:
        return 5
    if N==8 or N == 9 or N == 10 or N == 15 or N == 16 or N == 22:
        return 7
    # N = 12,14,18,20,21,24
    if N==12:
        return 11
    if N == 14:
        return 13
    if N == 18:
        return 17
    if N== 20 or N == 21:
        return 19
    if N==24 or N == 25:
        return 23
    
    return N-1 #???
    raise("err") 

N = int(input())
print(run(N))
0