CF306C.White, Black and White Again
提高+/省选-
通过率:0%
时间限制:3.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Polycarpus is sure that his life fits the description: "first there is a white stripe, then a black one, then a white one again". So, Polycarpus is sure that this rule is going to fulfill during the next n days. Polycarpus knows that he is in for w good events and b not-so-good events. At least one event is going to take place during each day. As each day is unequivocally characterizes as a part of a white or a black stripe, then each day is going to have events of the same type only (ether good or not-so-good).
What is the number of distinct ways this scenario can develop over the next n days if Polycarpus is in for a white stripe (a stripe that has good events only, the stripe's length is at least 1 day), the a black stripe (a stripe that has not-so-good events only, the stripe's length is at least 1 day) and a white stripe again (a stripe that has good events only, the stripe's length is at least 1 day). Each of n days will belong to one of the three stripes only.
Note that even the events of the same type are distinct from each other. Even if some events occur on the same day, they go in some order (there are no simultaneous events).
Write a code that prints the number of possible configurations to sort the events into days. See the samples for clarifications on which scenarios should be considered distinct. Print the answer modulo 1000000009 (109 + 9).
波利卡普斯确信自己的人生符合这样的描述:“先是一段白色条带,然后是一段黑色条带,再然后又是一段白色条带”。因此,波利卡普斯确信这一规律将在接下来的 n 天内持续成立。波利卡普斯知道他将经历 w 个好事件和 b 个不太好的事件。每一天至少会发生一个事件。由于每一天都明确地属于某一段白色条带或黑色条带,因此每一天所发生的事件类型必须完全相同(即要么全是好事件,要么全为不太好的事件)。
在接下来的 n 天中,若波利卡普斯将依次经历:一段白色条带(仅含好事件,其长度至少为 1 天)、一段黑色条带(仅含不太好的事件,其长度至少为 1 天)、再一段白色条带(仅含好事件,其长度至少为 1 天),那么该场景共有多少种不同的发展方式?这 n 天中的每一天恰好属于上述三段条带中的一段。
注意:即使同类型的事件也是彼此互异的。即使某些事件发生在同一天,它们也按某种顺序发生(不存在真正意义上的“同时”事件)。
请编写代码,输出将这些事件分配到各天的所有可能配置数目。参见样例以进一步明确哪些情形应被视为互不相同。答案需对 1000000009(即 109+9)取模后输出。
输入格式
The single line of the input contains integers n, w and b (3 ≤ n ≤ 4000, 2 ≤ w ≤ 4000, 1 ≤ b ≤ 4000) — the number of days, the number of good events and the number of not-so-good events. It is guaranteed that w + b ≥ n.
输入仅包含一行,其中为整数 n、w 和 b(3 ≤ n ≤ 4000,2 ≤ w ≤ 4000,1 ≤ b ≤ 4000),分别表示天数、好事件的数量和不太好的事件的数量。保证 w + b ≥ n。
输出格式
Print the required number of ways modulo 1000000009 (109 + 9).
输出所需的方案数对 1000000009(109+9)取模的结果。
输入输出样例
输入#1
3 2 1
输出#1
2
输入#2
4 2 2
输出#2
4
输入#3
3 2 2
输出#3
4
说明/提示
We'll represent the good events by numbers starting from 1 and the not-so-good events — by letters starting from 'a'. Vertical lines separate days.
In the first sample the possible ways are: "1|a|2" and "2|a|1". In the second sample the possible ways are: "1|a|b|2", "2|a|b|1", "1|b|a|2" and "2|b|a|1". In the third sample the possible ways are: "1|ab|2", "2|ab|1", "1|ba|2" and "2|ba|1".
我们将用从 1 开始的数字表示“好”事件,用从字母 'a' 开始的字母表示“不太好的”事件。竖线 | 用于分隔不同日期。
在第一个样例中,可能的排列方式有:“1|a|2” 和 “2|a|1”。
在第二个样例中,可能的排列方式有:“1|a|b|2”、“2|a|b|1”、“1|b|a|2” 和 “2|b|a|1”。
在第三个样例中,可能的排列方式有:“1|ab|2”、“2|ab|1”、“1|ba|2” 和 “2|ba|1”。
输入解题思路,AI测评打分。不知道怎么写?