結果

問題 No.312 置換処理
ユーザー hanorverhanorver
提出日時 2015-12-05 17:20:55
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 390 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 10,924 KB
実行使用メモリ 8,916 KB
最終ジャッジ日時 2023-10-12 15:46:20
合計ジャッジ時間 2,806 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
8,840 KB
testcase_01 AC 31 ms
8,756 KB
testcase_02 AC 30 ms
8,692 KB
testcase_03 AC 30 ms
8,760 KB
testcase_04 AC 20 ms
8,832 KB
testcase_05 WA -
testcase_06 AC 26 ms
8,740 KB
testcase_07 AC 58 ms
8,760 KB
testcase_08 AC 19 ms
8,828 KB
testcase_09 AC 19 ms
8,884 KB
testcase_10 AC 19 ms
8,904 KB
testcase_11 AC 32 ms
8,852 KB
testcase_12 AC 19 ms
8,760 KB
testcase_13 AC 19 ms
8,872 KB
testcase_14 AC 18 ms
8,800 KB
testcase_15 AC 19 ms
8,752 KB
testcase_16 AC 18 ms
8,748 KB
testcase_17 AC 19 ms
8,744 KB
testcase_18 AC 19 ms
8,892 KB
testcase_19 AC 19 ms
8,848 KB
testcase_20 AC 18 ms
8,704 KB
testcase_21 AC 19 ms
8,864 KB
testcase_22 AC 20 ms
8,696 KB
testcase_23 AC 19 ms
8,756 KB
testcase_24 AC 19 ms
8,836 KB
testcase_25 AC 19 ms
8,872 KB
testcase_26 AC 19 ms
8,812 KB
testcase_27 AC 19 ms
8,700 KB
testcase_28 AC 18 ms
8,864 KB
testcase_29 AC 20 ms
8,916 KB
testcase_30 AC 29 ms
8,828 KB
testcase_31 AC 19 ms
8,764 KB
testcase_32 AC 29 ms
8,844 KB
testcase_33 AC 30 ms
8,840 KB
testcase_34 AC 30 ms
8,760 KB
testcase_35 AC 23 ms
8,844 KB
testcase_36 AC 19 ms
8,740 KB
testcase_37 AC 19 ms
8,696 KB
testcase_38 AC 18 ms
8,708 KB
testcase_39 AC 18 ms
8,760 KB
testcase_40 AC 19 ms
8,828 KB
testcase_41 AC 19 ms
8,844 KB
testcase_42 AC 18 ms
8,760 KB
testcase_43 AC 18 ms
8,840 KB
testcase_44 AC 19 ms
8,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import random as s
def p(q,k=1000):
 if q%2==0:return 0
 d=(q-1)>>1
 while d&1==0:d>>=1
 while k:
  k-=1
  t=d
  y=pow(s.randint(1,q-1),t,q)
  while t!=q-1 and y!=1 and y!=q-1: 
   y=pow(y,2,q)
   t<<=1
  if y!=q-1 and t&1==0:return 0
 return 1

n=int(input())
if p(n):
 print(n)
elif p(n//2):
 print(n//2)
else:
  for i in range(3,n+3):
   if n%i==0:
    print(i)
    break
  else:print(n)
0