

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
注意
この問題に対する言及は、2021/7/17 18:00 JST まで禁止されています。言及がなされた場合、賠償が請求される可能性があります。 試験後に総合得点や認定級を公表するのは構いませんが、どの問題が解けたかなどの情報は発信しないようにお願いします。
問題文
正整数 を、相異なる べきの和差で表してください。
形式的には、以下の条件をすべて満たす数列 を構築してください。
- の長さを として、
- 各 について、 は べき。即ち、ある非負整数 を用いて と表すことができる。
この問題の制約下で、このような数列 の存在は保証されます。
制約
- は整数
入力
入力は以下の形式で標準入力から与えられる。
出力
以下の形式で問題文中の条件を満たす数列 を出力せよ。問題文同様、 は の長さを表す。
条件を満たす が複数存在する場合、そのいずれを出力してもよい。
入力例 1Copy
6
出力例 1Copy
2 9 -3
と は共に べきであり、また であるため、この出力は問題文中の条件を満たします。
入力例 2Copy
9193
出力例 2Copy
9 2187 27 1 -243 3 9 -81 6561 729
入力例 3Copy
10120190919012
出力例 3Copy
16 -1594323 9 -177147 -531441 1162261467 -4782969 387420489 -6561 -2187 2541865828329 -27 7625597484987 3486784401 10460353203 -94143178827 31381059609
入力が bit 整数型に収まりきらない場合があります。
Score : points
Warning
Do not make any mention of this problem until July 17, 2021, 6:00 p.m. JST. In case of violation, compensation may be demanded. After the examination, you can reveal your total score and grade to others, but nothing more (for example, which problems you solved).
Problem Statement
Represent a positive integer by additions and subtractions of distinct powers of .
Formally, construct a sequence that satisfies all of the following conditions.
- , where is the length of .
- .
- .
- For each , is a power of . That is, there is a non-negative integer such that .
- .
It is guaranteed that such a sequence exists under the Constraints of this problem.
Constraints
- is an integer.
Input
Input is given from Standard Input in the following format:
Output
Print a sequence that satisfies the conditions in the Problem Statement in the format below, where again denotes the length of .
If there are multiple sequences satisfying the conditions, you may print any of them.
Sample Input 1Copy
6
Sample Output 1Copy
2 9 -3
Both and are powers of , and we have , so this output satisfies the conditions.
Sample Input 2Copy
9193
Sample Output 2Copy
9 2187 27 1 -243 3 9 -81 6561 729
Sample Input 3Copy
10120190919012
Sample Output 3Copy
16 -1594323 9 -177147 -531441 1162261467 -4782969 387420489 -6561 -2187 2541865828329 -27 7625597484987 3486784401 10460353203 -94143178827 31381059609
Input may not fit into a -bit integer type.