Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Non-divisible 2-3 Power Sums
Description Every positive integer ^{a})(3^{b}) where no term in the sum exactly divides any other term in the sum. For example:
Note from the example of 31 that the representation is not unique. Write a program which takes as input a positive integer as a sum of terms of the form (2N^{a})(3^{b}).Input The first line of input contains a single integer ≤ 1000) which is the number of datasets that follow.CEach dataset consists of a single line of input containing a single integer < 2N^{31}), which is the number to be represented as a sum of terms of the form (2^{a})(3^{b}).Output For each dataset, the output will be a single line consisting of: The dataset number, a single space, the number of terms in your sum as a decimal integer followed by a single space followed by representations of the terms in the form Sample Input 6 1 7 31 7776 531441 123456789 Sample Output 1 1 [0,0] 2 2 [2,0] [0,1] 3 3 [4,0] [0,2] [1,1] 4 1 [5,5] 5 1 [0,12] 6 8 [3,13] [4,12] [2,15] [7,8] [9,6] [0,16] [10,5] [15,2] Source |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator