当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3092:Non-divisible 2-3 Power Sums

Special Judge 特殊评判
题目描述

Every positive integer N can be written in at least one way as a sum of terms of the form (2a)(3b) where no term in the sum exactly divides any other term in the sum. For example:

1 = (20)(30)
7 = (22)(30) + (20)(31)
31 = (24)(30) + (20)(32) + (21)(31) = (22) + (33)

Note from the example of 31 that the representation is not unique.

Write a program which takes as input a positive integer N and outputs a representation of N as a sum of terms of the form (2a)(3b).

输入解释

The first line of input contains a single integer C (1 ≤ C ≤ 1000) which is the number of datasets that follow.

Each dataset consists of a single line of input containing a single integer N (1 ≤ N < 231), which is the number to be represented as a sum of terms of the form (2a)(3b).

输出解释

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 [<2 exponent>,<3 exponent>] with terms separated by a single space. <2 exponent> is the power of 2 in the term and <3 exponent> is the power of 3 in the term.

输入样例
6
1
7
31
7776
531441
123456789
输出样例
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]

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 Greater New York 2006

源链接: POJ-3092

最后修改于 2020-10-29T06:52:21+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536