求助,麻烦翻译一道编程题目DescriptionConsider the set of all non-negative integer powers of 3. S = { 1, 3, 9, 27, 81, ... } Consider the sequence of all subsets of S ordered by the value of the sum of their elements. The question is simple

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/28 20:51:02

求助,麻烦翻译一道编程题目DescriptionConsider the set of all non-negative integer powers of 3. S = { 1, 3, 9, 27, 81, ... } Consider the sequence of all subsets of S ordered by the value of the sum of their elements. The question is simple
求助,麻烦翻译一道编程题目
Description
Consider the set of all non-negative integer powers of 3.
S = { 1, 3, 9, 27, 81, ... }
Consider the sequence of all subsets of S ordered by the value of the sum of their elements. The question is simple: find the set at the n-th position in the sequence and print it in increasing order of its elements.
Input
Each line of input contains a number n, which is a positive integer with no more than 19 digits. The last line of input contains 0 and it should not be processed.
Output
For each line of input, output a single line displaying the n-th set as described above, in the format used in the sample output.

求助,麻烦翻译一道编程题目DescriptionConsider the set of all non-negative integer powers of 3. S = { 1, 3, 9, 27, 81, ... } Consider the sequence of all subsets of S ordered by the value of the sum of their elements. The question is simple
设想一个所有3的非负整数幂的集合:
S = { 1,3,9,27,81,...}
设想S的所有子集所组成的序列,按照其元素的和的大小排序.
我们的问题非常简单:找到此序列中第n个位置上的集合,并打印出来,打印时按其元素的递增顺序排序.
输入
每一行输入包含一个数字n,它是一个正整数,位数不超过19.最后一行包含数字0,对此行不做处理.
输出
对每行输入的数字,输出一行,显示上面描述的第n个集合,其格式与样本输出相同.