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

建议使用的浏览器:

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

1822:Fence2

题目描述
Having great success in painting the first fence, the workers were hired to paint the fence of one of the richest men in the town. Being satisfied with the sum offered to the entire team, the workers hadn't made caprices this time. They decided, however, to work in shifts: first the workers from the first shift, and then the ones from the second a.s.o. In each shift will work at least one and at most k workers. Also, each worker will work in exactly one shift. Surprised by the organization of the workers and being a lover of the counting problems, the owner of the fence wants to find out in how many ways the workers can be arranged in shifts. Because he announced that he will offer a great sum of money to the one that will give him the answer, you decided to write a program that will help you to win the first prize of the game.

Write a program that, for the values of N and K given, determinate how many possibilities to arrange the N workers in shifts exist, thus in each shift work at least one and at most K of them. Two arrangements are distinct if there exists one worker who works in shifts with different ordinal numbers.
输入解释
In the first line of the input there are two integers: N and K (1 <= K <= N <= 50), representing the total number of workers and the maximal number of workers that can work in the same shift.
输出解释
In the output you will write the determined number
输入样例
3 2
输出样例
12
提示
For this sample the arrangements in shifts are:

Possibility 1

Possibility 2

Possibility 3

Possibility 4

Possibility 5

Possibility 6

Shift1: 1 2

Shift1: 1 3

Shift1: 3 2

Shift1: 1

Shift1: 2

Shift1: 3

Shift2: 3

Shift2: 2

Shift2: 1

Shift2: 2 3

Shift2: 3 1

Shift2: 1 2

      

Possibility 7

Possibility 8

Possibility 9

Possibility 10

Possibility 11

Possibility 12

Shift1: 1

Shift1: 1

Shift1: 2

Shift1: 2

Shift1: 3

Shift1: 3

Shift2: 2

Shift2: 3

Shift2: 1

Shift2: 3

Shift2: 1

Shift2: 2

Shift3: 3

Shift3: 2

Shift3: 3

Shift3: 1

Shift3: 2

Shift3: 1




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

题目来源 Romania OI 2002

源链接: POJ-1822

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

共提交 0

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