結果

問題 No.1871 divisXor
ユーザー nasutarou1341
提出日時 2022-03-11 22:22:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 430 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 57,856 KB
最終ジャッジ日時 2024-09-16 02:43:38
合計ジャッジ時間 7,798 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
def isPrime(n):
  last = math.floor(n ** 0.5)
  for i in range(2, last + 1):
    if n % i == 0:
      return False
  return True


N = int(input())

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

a = []
while N > 7:
  b = N - 1
  while not isPrime(b):
    b += 1
  a.append(b)
  N ^= (b + 1)

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(*a)

0