QOJ.ac

QOJ

时间限制: 1.0 s 内存限制: 256 MB 总分: 100

#6803. 一道数学题

统计

有 $n$ 个粉丝 $F_i (i = 1, \dots, n)$ 和 $m$ 个队伍 $T_j (j = 1, \dots, m)$。

(i) 对于任意粉丝 $F_i$,$F_i$ 至少是一个队伍的粉丝,但不是所有队伍的粉丝。

(ii) 对于任意两个队伍 $T_i, T_j (1 \le i, j \le m)$,存在唯一一个队伍 $T_k (1 \le k \le m)$,其粉丝恰好是 $T_i$ 和 $T_j$ 的粉丝的交集。注意 $i, j, k$ 可以相同。

(iii) 对于任意两个队伍 $T_i, T_j (1 \le i, j \le m)$,存在唯一一个队伍 $T_k (1 \le k \le m)$,其粉丝恰好是 $T_i$ 和 $T_j$ 的粉丝的并集。注意 $i, j, k$ 可以相同。

请计算粉丝与队伍之间有多少种对应关系。

输入格式

输入包含多组测试数据。第一行包含一个整数 $T (T \le 100000)$,表示测试数据的组数。对于每组测试数据:

第一行包含两个整数 $n, m (1 \le n \le 10^{18}, 2 \le m \le 6)$。

输出格式

对于每组测试数据,输出一个整数,表示答案对 $1000000007 (10^9 + 7)$ 取模的结果。

样例

输入 1

9
2 2
2 3
3 3
3 4
4 4
4 5
5 5
5 6
6 6

输出 1

2
12
36
216
1032
7200
46800
453600
3369600

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#333EditorialOpen题解jiangly2025-12-14 07:07:45View

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.