Description
B June recently heard of a very amazing nature, set P=1+i p=1+i, for each Gaussian integer
X+yi x + yi, we can all find a non-negative integer set S satisfying ∑k∈spk=x+yi () \sum _{k∈s}{p^k} = X+yi ()
And all you have to do is output the set of s in the case of input x and Y.
If you do not understand the above topic, we formally give the following definition.
is for a complex number (Complex number), if his real and imaginary parts are integers, we call them Gaussian integers.
The S collection cannot have the same elements, and each element must be a non-negative integer.
Input
A row of two integers, x, Y. Output
Each line of an integer, from small to large output, represents the collection S. Sample Input
2 0 Sample Output
2
3 Hint
For 100% of data, meet |x|,|y|<=1018 |x|,|y|.
For 50% of data, y = 0 is met.
For 50% of data, meet |x|,|y|<=102 |x|,|y|.
The above two parts 50% are independent of each other. Solving
By playing the PK P^k, you can find a mysterious law: pn=−2 (pn−1+pn−2) p^n = -2 (P^{n-1}+p^{n-2})
The proof is simple:
−2 (pn−1+pn−2) ====−2[pn−2x (p+1)]pn−2x (−2i) PN−2XP2PN