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

建议使用的浏览器:

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

7048:Link with EQ

题目描述
We often say that details can reflect the level of one's EQ. For example, at BIT, when students study in classrooms (such as A105 in the General Teaching Building) or on long tables in the library, it is often embarrassing and uncomfortable (and occasionally smelly) if another student suddenly sits next to them, which we call low EQ behavior.

Now, there is a long table containing $n$ seats, and the BIT students will choose their seats in the following way in order to avoid low EQ behavior as much as possible.
- If the whole table is empty, randomly choose a position to sit.
- Otherwise, choose a position whose shortest distance to other students is maximized. If there are more than one, randomly choose one of them with equal possibility.

When the farthest distance is $1$ (i.e., he will sit next to a classmate anyway), students will sit at a different table to avoid low EQ behavior, and then we will call the table full.

Now, Link wants to know the expected number of people seated in the table when the table is full.
输入解释
The input consists of multiple test cases.

The first line contains an integer $T$ ($1 \leq T \leq 10^5$) -- the number of test cases.

For each testcase, there is only one integer $n$ ($1 \leq n \leq 10^6$) in a single line, which is the length of the table.
输出解释
For each testcase, output the answer modulo $10^9+7$.

You may find the way to modulo a rational number in Problem 1006.
输入样例
5
1
2
3
4
2021
输出样例
1
1
666666673
2
420089906

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7048

最后修改于 2021-10-23T19:11:12+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 262144/262144K(Java/Others)