22005_Partitioningforfunandprofi

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

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

Pro.ID

22005

Title

Partitioning for fun and profit

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

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

    A partition of a positive integer number m into n elements (nm) is a sequence of positive numbers a1, ...,an such that a1+...+an = m and a1a2 ≤ ... ≤ an. Your task is to find a partition of a number m which occupies the k-th position in the lexicographically ordered sequence of all partitions of m into n elements.

    The lexicographic ordering among the partitions of a number is defined as follows. For two partitions a and b of m into n elements such that a = [a1,...,an] and b = [b1,...,bn] we have a < b if and only if there exists an 1 ≤ in such that for all j < i we have aj = bj and ai < bi. The sequence of all partitions is ordered in increasing lexicographic order and at the first we have the following sequence 1, 1, ... 1, m-n+1.

    输入

    The first line of input contains a number c giving the number of cases that follow. Each of the subsequent c lines contains three numbers: 1 ≤ m ≤ 220, 1 ≤ n ≤ 10 and 1 ≤ k which is not bigger than the number of partitions of m into n elements.

    输出

    Description

    A partition of a positive integer number m into n elements (nm) is a sequence of positive numbers a1, ...,an such that a1+...+an = m and a1a2 ≤ ... ≤ an. Your task is to find a partition of a number m which occupies the k-th position in the lexicographically ordered sequence of all partitions of m into n elements.

    The lexicographic ordering among the partitions of a number is defined as follows. For two partitions a and b of m into n elements such that a = [a1,...,an] and b = [b1,...,bn] we have a < b if and only if there exists an 1 ≤ in such that for all j < i we have aj = bj and ai < bi. The sequence of all partitions is ordered in increasing lexicographic order and at the first we have the following sequence 1, 1, ... 1, m-n+1.

    Input

    The first line of input contains a number c giving the number of cases that follow. Each of the subsequent c lines contains three numbers: 1 ≤ m ≤ 220, 1 ≤ n ≤ 10 and 1 ≤ k which is not bigger than the number of partitions of m into n elements.

    Output

    For each input data set print the k-th partition of m into n elements. Each element of a partition is to be printed in a separate line.

    Sample Input

    2
    9 4 3
    10 10 1

    Sample Output

    1
    1
    3
    4
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1

    Source

    样例输入

    2
    9 4 3
    10 10 1

    样例输出

    1
    1
    3
    4
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部