10243_Threepowers

2022-5-16 18:16| 发布者: Hocassian| 查看: 75| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-3-89504692395099-Problem List-采集的数据-后羿采集器.html

Pro.ID

10243

Title

Three powers

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=10243

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 1000/500 MS (Java/Others)     Memory Limit: 32768/32768 K (Java/Others)
  • 描述

    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.

    输入

    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.

    输出

    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.

    Sample Input
    1
    7
    14
    783
    1125900981634049
    0
    Sample Output
    { }
    { 3, 9 }
    { 1, 9, 27 }
    { 3, 9, 27, 6561, 19683 }
    { 59049, 3486784401, 205891132094649, 717897987691852588770249 }
    Source

    样例输入

    1
    7
    14
    783
    1125900981634049
    0

    样例输出

    { }
    { 3, 9 }
    { 1, 9, 27 }
    { 3, 9, 27, 6561, 19683 }
    { 59049, 3486784401, 205891132094649, 717897987691852588770249 }

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部