AtCoder Beginner Contest 205
E
White and Black Balls
AtCoder
⌀ 2025
原题
← DF →
翻译中…

Problem Statement

翻译中…

How many ways are there to arrange $N$ white balls and $M$ black balls in a row from left to right to satisfy the following condition?

翻译中…
  • For each $i$ $(1 \leq i \leq N + M)$, let $w_i$ and $b_i$ be the number of white balls and black balls among the leftmost $i$ balls, respectively. Then, $w_i \leq b_i + K$ holds for every $i$.
翻译中…

Since the count can be enormous, find it modulo $(10^9 + 7)$.

翻译中…

Constraints

翻译中…
  • $0 \leq N, M \leq 10^6$
  • $1 \leq N + M$
  • $0 \leq K \leq N$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N M K

翻译中…

Output

翻译中…

Print the answer. Be sure to find the count modulo $(10^9 + 7)$.

翻译中…

样例

Input #1
2 3 1
Output #1
9
There are $10$ ways to arrange $2$ white balls and $3$ black balls in a row, as shown below, where `w` and `b` stand for a white ball and a black ball, respectively. `wwbbb` `wbwbb` `wbbwb` `wbbbw` `bwwbb` `bwbwb` `bwbbw` `bbwwb` `bbwbw` `bbbww` Among them, `wwbbb` is the only one that does not satisfy the condition. Here, there are $2$ white balls and $0$ black balls among the $2$ leftmost balls, and we have $2 > 0 + K = 1$.
Input #2
1 0 0
Output #2
0
There may be no way to satisfy the condition.
Input #3
1000000 1000000 1000000
Output #3
192151600
Be sure to print the count modulo $(10^9 + 7)$.
题目信息
题号
abc205_e
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。