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

建议使用的浏览器:

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

3556:Increasing subsequences

题目描述

A sequence p(1), p(2), …, p(N) consisting of numbers 1, 2, …, N is called a permutation if all elements in the sequence are different.

It is said that a permutation p contains increasing subsequence of k elements when there are numbers 1 ≤ i1 < i2 < … < ik ≤ N such that p(i1) < p(i2) < … < p(ik).

When a permutation p contains an increasing subsequence consisting of B elements and does not contain an increasing subsequence consisting of B+1 elements then the number B is called the degree of increase of this permutation.

You need to write a program which being given a number N calculates the number of permutations whose degree of increase is B. Since the number of such permutations might be quite big, it is necessary to calculate its remainder of integer division by 1 000 000 000.

输入解释

The input consists of one line. The line contains two integer numbers N and B (1 ≤ N ≤ 40, 1 ≤ B ≤ 5) separated by one or more spaces.

输出解释

The output contains one integer number which is the remainder of integer division by 1 000 000 000 of the number of permutations whose degree of increase is B.

输入样例
3 2
输出样例
4

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

源链接: POJ-3556

最后修改于 2020-10-29T07:04:28+00:00 由爬虫自动更新

共提交 0

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