結果

問題 No.308 素数は通れません
ユーザー kzyKTkzyKT
提出日時 2015-12-01 02:17:43
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 412 bytes
コンパイル時間 68 ms
コンパイル使用メモリ 6,736 KB
実行使用メモリ 13,256 KB
最終ジャッジ日時 2023-10-12 07:00:48
合計ジャッジ時間 5,081 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
13,100 KB
testcase_01 AC 15 ms
8,836 KB
testcase_02 AC 15 ms
8,832 KB
testcase_03 AC 15 ms
8,820 KB
testcase_04 AC 14 ms
8,908 KB
testcase_05 AC 14 ms
8,904 KB
testcase_06 AC 15 ms
8,908 KB
testcase_07 AC 14 ms
8,936 KB
testcase_08 AC 14 ms
8,956 KB
testcase_09 AC 14 ms
8,800 KB
testcase_10 AC 15 ms
8,828 KB
testcase_11 AC 14 ms
8,776 KB
testcase_12 AC 15 ms
8,800 KB
testcase_13 AC 14 ms
8,832 KB
testcase_14 AC 15 ms
9,020 KB
testcase_15 AC 14 ms
8,940 KB
testcase_16 AC 15 ms
8,828 KB
testcase_17 AC 15 ms
8,772 KB
testcase_18 AC 14 ms
8,796 KB
testcase_19 AC 14 ms
8,956 KB
testcase_20 WA -
testcase_21 AC 15 ms
8,776 KB
testcase_22 AC 15 ms
8,824 KB
testcase_23 AC 15 ms
8,900 KB
testcase_24 AC 14 ms
8,912 KB
testcase_25 AC 15 ms
8,800 KB
testcase_26 AC 15 ms
8,820 KB
testcase_27 AC 15 ms
8,844 KB
testcase_28 AC 14 ms
8,820 KB
testcase_29 AC 14 ms
8,828 KB
testcase_30 AC 14 ms
8,796 KB
testcase_31 AC 14 ms
8,840 KB
testcase_32 AC 15 ms
8,828 KB
testcase_33 AC 16 ms
8,828 KB
testcase_34 AC 15 ms
8,896 KB
testcase_35 AC 15 ms
8,920 KB
testcase_36 AC 15 ms
8,824 KB
testcase_37 AC 15 ms
8,944 KB
testcase_38 AC 15 ms
8,748 KB
testcase_39 AC 15 ms
8,996 KB
testcase_40 AC 15 ms
8,800 KB
testcase_41 AC 15 ms
8,912 KB
testcase_42 AC 15 ms
8,916 KB
testcase_43 AC 15 ms
8,820 KB
testcase_44 AC 15 ms
8,940 KB
testcase_45 AC 15 ms
8,944 KB
testcase_46 AC 15 ms
8,996 KB
testcase_47 AC 15 ms
8,992 KB
testcase_48 AC 16 ms
8,820 KB
testcase_49 AC 15 ms
8,968 KB
testcase_50 AC 16 ms
8,820 KB
testcase_51 AC 16 ms
8,832 KB
testcase_52 AC 16 ms
8,828 KB
testcase_53 AC 15 ms
9,020 KB
testcase_54 AC 15 ms
8,776 KB
testcase_55 AC 15 ms
8,948 KB
testcase_56 TLE -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
testcase_64 -- -
testcase_65 -- -
testcase_66 -- -
testcase_67 -- -
testcase_68 -- -
testcase_69 -- -
testcase_70 -- -
testcase_71 -- -
testcase_72 -- -
testcase_73 -- -
testcase_74 -- -
testcase_75 -- -
testcase_76 -- -
testcase_77 -- -
testcase_78 -- -
testcase_79 -- -
testcase_80 -- -
testcase_81 -- -
testcase_82 -- -
testcase_83 -- -
testcase_84 -- -
testcase_85 -- -
testcase_86 -- -
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 #

import random
def solve(x):
  x=x-1
  while x%2==0:
    x>>=1
  for l in range(0,30):
    r=random.randint(1,x-1)
    t=x
    y=pow(r,t,x)
    while t!=x-1 and y!=1 and y!=x-1:
      y=(y*y)%x
      t<<=1
    if y!=x-1 and t&1==0:
      return False
  return True
a=[0,0,0,0,3,0,5,0,7,7,7,0,11,0,13,7,7,0,8,0,19,19,7,0,23,23]
x=input()
if x<26:print a[x]
else:print 14 if (x-1)%8==0 and x%2 and solve(x-8) else 8
0