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

建议使用的浏览器:

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

2522:Partitioning for fun and profit

题目描述
A partition of a positive integer number m into n elements (n <= m) is a sequence of positive numbers a1,...,an such that a1+...+an = m and a1 <= a2 <= ... <= 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 <= i <= n 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.
输出解释
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.
输入样例
2
9 4 3 
10 10 1
输出样例
1
1
3
4
1
1
1
1
1
1
1
1
1
1

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

源链接: POJ-2522

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

共提交 0

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