QOJ.ac

QOJ

Límite de tiempo: 2.0 s Límite de memoria: 512 MB Puntuación total: 100

#14799. 方块

Estadísticas

Sophie 正在玩 $n$ 个长方体积木。其中第 $i$ 个积木的大小为 $1 \times 1 \times i$。

她最喜欢的游戏是将所有积木平行排成一排,使得它们都以 $1 \times 1$ 的面立在地上(即,这些面是它们的底面)。摆放好积木后,Sophie 站在很远的地方,从这一排的两端(我们称之为左端和右端)观察积木的排列。她走得足够远,以至于每个积木都会遮挡住它后面所有比它矮的积木。如果她从左端恰好能看到 $\ell$ 个积木,从右端恰好能看到 $p$ 个积木,Sophie 就会感到满意。

她想知道存在多少种满足条件的积木排列方式。请编写一个程序帮助 Sophie:读取积木的数量以及她希望从左端和右端看到的积木数量,计算满足条件的排列数量,并将结果输出到标准输出。

输入格式

输入的第一行包含数据组数 $m$ ($1 \le m \le 100\,000$)。

接下来的 $m$ 行,每行描述一组数据。每组数据的描述包含三个整数 $n$, $\ell$, $p$ ($1 \le n \le 50\,000$, $1 \le \ell, p \le 100$),它们之间用单个空格分隔。这些整数分别表示给定的积木数量、Sophie 希望从左端看到的积木数量,以及她希望从右端看到的积木数量。

输出格式

对于每组数据,你的程序应该输出一行,仅包含一个整数:满足条件的积木排列数量模 $10^9 + 7$ 的余数。

样例

输入样例 1

2
4 3 2
5 3 3

输出样例 1

3
6

说明

在第一组数据中,Sophie 对以下积木排列感到满意:$(1, 2, 4, 3)$,$(1, 3, 4, 2)$,$(2, 3, 4, 1)$。在 $(1, 2, 4, 3)$ 排列中,从左边可以看到积木 1、2 和 4,而从右边可以看到积木 4 和 3。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.