結果

問題 No.1871 divisXor
ユーザー nasutarou1341nasutarou1341
提出日時 2022-03-11 22:27:54
言語 PyPy3
(7.3.15)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 569 bytes
コンパイル時間 198 ms
コンパイル使用メモリ 81,568 KB
実行使用メモリ 59,788 KB
最終ジャッジ日時 2023-10-23 19:14:14
合計ジャッジ時間 4,972 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,788 KB
testcase_01 AC 38 ms
53,500 KB
testcase_02 AC 188 ms
59,532 KB
testcase_03 AC 97 ms
59,788 KB
testcase_04 AC 77 ms
59,532 KB
testcase_05 AC 56 ms
57,484 KB
testcase_06 AC 67 ms
59,532 KB
testcase_07 AC 58 ms
57,484 KB
testcase_08 AC 85 ms
57,484 KB
testcase_09 AC 131 ms
59,532 KB
testcase_10 AC 120 ms
59,532 KB
testcase_11 AC 69 ms
59,532 KB
testcase_12 AC 56 ms
57,484 KB
testcase_13 AC 46 ms
57,484 KB
testcase_14 AC 79 ms
59,532 KB
testcase_15 AC 53 ms
57,484 KB
testcase_16 AC 68 ms
59,532 KB
testcase_17 AC 87 ms
57,484 KB
testcase_18 AC 50 ms
57,484 KB
testcase_19 AC 85 ms
59,532 KB
testcase_20 AC 93 ms
59,532 KB
testcase_21 AC 73 ms
57,484 KB
testcase_22 AC 39 ms
53,524 KB
testcase_23 AC 39 ms
53,524 KB
testcase_24 AC 39 ms
53,524 KB
testcase_25 AC 38 ms
53,524 KB
testcase_26 AC 85 ms
57,484 KB
testcase_27 AC 71 ms
57,484 KB
testcase_28 AC 57 ms
57,484 KB
testcase_29 AC 108 ms
57,484 KB
testcase_30 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
def divisor(n):
  L, R = [1], [n]
  last = math.floor(n ** 0.5)
  for i in range(2, last + 1):
    if n % i == 0:
      L.append(i)
      if i != n // i:
        R.append(n // i)
  return sum(L + R[::-1])

N = int(input())

if N == 0:
  print(-1)
  exit()

a = []
while N > 7:
  b = N - 1
  while True:
    x = divisor(b)
    if len(bin(x)) == len(bin(N)):
      break
    b -= 1
  a.append(b)
  N ^= x

if N >= 4:
  a.append(3)
  N ^= 4
if N == 1:
  a.append(1)
elif N == 2:
  a.append(2)
  a.append(1)
elif N == 3:
  a.append(2)

print(len(a))
print(*a)

0