求助,麻烦翻译一道编程题目
来源:学生作业帮 编辑:百度作业网作业帮 分类:英语作业 时间:2024/08/08 07:16:23
求助,麻烦翻译一道编程题目
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.
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.
![求助,麻烦翻译一道编程题目](/uploads/image/z/16739935-7-5.jpg?t=%E6%B1%82%E5%8A%A9%2C%E9%BA%BB%E7%83%A6%E7%BF%BB%E8%AF%91%E4%B8%80%E9%81%93%E7%BC%96%E7%A8%8B%E9%A2%98%E7%9B%AE)
设想一个所有3的非负整数幂的集合:
S = { 1,3,9,27,81,...}
设想S的所有子集所组成的序列,按照其元素的和的大小排序.
我们的问题非常简单:找到此序列中第n个位置上的集合,并打印出来,打印时按其元素的递增顺序排序.
输入
每一行输入包含一个数字n,它是一个正整数,位数不超过19.最后一行包含数字0,对此行不做处理.
输出
对每行输入的数字,输出一行,显示上面描述的第n个集合,其格式与样本输出相同.
S = { 1,3,9,27,81,...}
设想S的所有子集所组成的序列,按照其元素的和的大小排序.
我们的问题非常简单:找到此序列中第n个位置上的集合,并打印出来,打印时按其元素的递增顺序排序.
输入
每一行输入包含一个数字n,它是一个正整数,位数不超过19.最后一行包含数字0,对此行不做处理.
输出
对每行输入的数字,输出一行,显示上面描述的第n个集合,其格式与样本输出相同.