|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||512 MB||7||3||3||42.857%|
You are given an equal arm scales, a set of weight pieces and an object. The pieces are of weight 1,3,9,27,81,..., i.e. the weight of each piece is a power of 3, and for each integer k ≥ 0 there is exactly one piece of weight 3k. The object’s weight is m, where m is a positive integer. Your task is to put the object on the left scale pan and to put some pieces on one or both scale pans, so that the scales is in balance.
Write a program that:
The first line contains one integer m, 1 ≤ m ≤ 10100.
The output should consist of two lines.
The first line should contain information about pieces put on the left scale pan. First number must be non-negative integer - number of pieces put on the left scale pan followed by weights of pieces in increasing order. Numbers must be separated by single spaces.
The second line must contain information about pieces put on the right scale pan in the same format as first line.
3 3 9 27 1 81
0 2 3 27