QOJ.ac

QOJ

Time Limit: 3 s Memory Limit: 256 MB Total points: 100

#843. 道路规划

Statistics

R 国的人们生活在一个有 $k$ 条街道的城市里,每条街道上坐落着 $n$ 栋房子,它们有秩序地按方阵排布。起初每两个街对面的房子也都是有道路联通的。简要说就是这些房子是以网格状道路联通的。然而最近市政府资金紧张,难以维护如此多的道路,因此不得不尽量减少道路的数量,但又要保证任意两栋房子都有道路能联通。注意,这里街上的道路也是可以拆掉一部分的。不难看出最后只会剩下 $kn - 1$ 条道路。请你计算一下,一共有多少种方案能满足这一要求?

答案对 $P = 10^9 + 7$ 取模。

输入格式

一行两个整数 $k, n$。

输出格式

输出一个数,表示答案。

样例数据

样例 1 输入

2 2

样例 1 输出

4

子任务

测试点编号 $k \le $ $n \le $
$1$ $2$ $5$
$2$ $3$
$3$ $2$ $10^5$
$4$ $10^9$
$5$ $3$ $10^4$
$6$ $4$
$7$ $5$
$8$ $10^9$
$9$ $6$ $10^3$
$10$ $10^9$

对于 $100\%$ 的数据,保证 $2 \le k \le 6$, $1 \le n \le 10^9$

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.