結果
| 問題 |
No.1871 divisXor
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-03-12 10:13:30 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 38 ms / 2,000 ms |
| コード長 | 375 bytes |
| コンパイル時間 | 394 ms |
| コンパイル使用メモリ | 82,348 KB |
| 実行使用メモリ | 53,696 KB |
| 最終ジャッジ日時 | 2024-09-22 13:02:07 |
| 合計ジャッジ時間 | 4,021 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 29 |
ソースコード
n = int(input())
if n == 0:
print(-1)
exit()
ans = [0]
if n&1:
ans.append(1)
for i in range(1,50):
if not n >> i & 1:
continue
ans.append(1<<i-1)
ans.append(1<<i)
ans.append(0)
ans2 = []
for i in range(1,len(ans)-1):
if ans[i] == ans[i-1] or ans[i] == ans[i+1]:
continue
ans2.append(ans[i])
print(len(ans2))
print(*ans2)