結果

問題 No.1312 Snake Eyes
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-06-16 09:18:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 519 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 87,416 KB
実行使用メモリ 76,812 KB
最終ジャッジ日時 2023-08-28 16:35:24
合計ジャッジ時間 10,804 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,432 KB
testcase_01 AC 70 ms
71,372 KB
testcase_02 AC 71 ms
71,444 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 69 ms
71,176 KB
testcase_06 AC 70 ms
71,284 KB
testcase_07 AC 71 ms
71,384 KB
testcase_08 AC 70 ms
71,304 KB
testcase_09 AC 70 ms
71,496 KB
testcase_10 AC 68 ms
71,504 KB
testcase_11 AC 69 ms
71,728 KB
testcase_12 AC 69 ms
71,324 KB
testcase_13 AC 69 ms
71,540 KB
testcase_14 AC 69 ms
71,376 KB
testcase_15 AC 68 ms
71,576 KB
testcase_16 AC 69 ms
71,504 KB
testcase_17 AC 68 ms
71,704 KB
testcase_18 AC 69 ms
71,696 KB
testcase_19 AC 69 ms
71,456 KB
testcase_20 AC 70 ms
71,504 KB
testcase_21 AC 68 ms
71,432 KB
testcase_22 AC 71 ms
71,452 KB
testcase_23 AC 70 ms
71,700 KB
testcase_24 AC 75 ms
76,008 KB
testcase_25 AC 73 ms
76,232 KB
testcase_26 AC 71 ms
71,376 KB
testcase_27 AC 82 ms
75,968 KB
testcase_28 AC 69 ms
71,484 KB
testcase_29 AC 73 ms
76,044 KB
testcase_30 AC 74 ms
76,012 KB
testcase_31 AC 74 ms
76,260 KB
testcase_32 AC 70 ms
71,280 KB
testcase_33 AC 76 ms
76,116 KB
testcase_34 AC 73 ms
76,060 KB
testcase_35 AC 77 ms
76,188 KB
testcase_36 AC 70 ms
71,632 KB
testcase_37 AC 75 ms
75,956 KB
testcase_38 AC 73 ms
76,260 KB
testcase_39 AC 71 ms
76,192 KB
testcase_40 AC 70 ms
76,168 KB
testcase_41 AC 71 ms
76,240 KB
testcase_42 AC 72 ms
76,316 KB
testcase_43 AC 73 ms
76,320 KB
testcase_44 AC 72 ms
76,256 KB
testcase_45 AC 72 ms
76,260 KB
testcase_46 AC 72 ms
76,108 KB
testcase_47 AC 72 ms
76,600 KB
testcase_48 AC 85 ms
76,248 KB
testcase_49 AC 84 ms
76,048 KB
testcase_50 AC 81 ms
76,244 KB
testcase_51 AC 76 ms
76,212 KB
testcase_52 AC 85 ms
76,640 KB
testcase_53 AC 82 ms
76,324 KB
testcase_54 AC 91 ms
76,308 KB
testcase_55 AC 78 ms
76,244 KB
testcase_56 AC 80 ms
76,328 KB
testcase_57 AC 82 ms
76,320 KB
testcase_58 AC 85 ms
76,548 KB
testcase_59 AC 77 ms
76,284 KB
testcase_60 AC 81 ms
76,108 KB
testcase_61 AC 87 ms
76,152 KB
testcase_62 AC 78 ms
76,328 KB
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 AC 70 ms
71,508 KB
testcase_67 AC 70 ms
71,380 KB
testcase_68 WA -
testcase_69 WA -
testcase_70 WA -
testcase_71 WA -
testcase_72 WA -
testcase_73 WA -
testcase_74 AC 70 ms
71,292 KB
testcase_75 WA -
testcase_76 AC 92 ms
76,812 KB
testcase_77 AC 87 ms
76,056 KB
testcase_78 AC 87 ms
76,244 KB
testcase_79 WA -
testcase_80 WA -
testcase_81 WA -
testcase_82 WA -
testcase_83 AC 86 ms
76,320 KB
testcase_84 AC 87 ms
76,296 KB
testcase_85 WA -
testcase_86 WA -
testcase_87 AC 80 ms
76,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
if n<=10**6:
  for i in range(2,n):
    nn=n
    t=nn%i
    nn//=i
    flg=True
    while nn:
      if t==nn%i:
        nn//=i
      else:
        flg=False
        break
    if flg:
      print(i)
      exit()
else:
  # ぞろ目になっても2桁を超えない
  st=set()
  for i in range(1,int(n**.5)+1):
    if n%i==0:
      st.add(i)
      st.add(n//i)
  ans=n-1
  # n=x*(p+1)
  # x:nの約数
  for x in st:
    p=n//x-1
    if p**2>n and p>1 and n%p==(n//p)%p:
      ans=min(ans,p)
  print(ans)
0