QOJ.ac

QOJ

时间限制: 1.5 s 内存限制: 512 MB 总分: 100 可 Hack ✓

#18104. 简单图

统计

一个无向简单图 $G$ 可以被划分为若干个连通分量。设 $x$ 为这些连通分量中树的数量。那么图 $G$ 的权值定义为 $x^k$。

给定 $n$ 和 $k$,你的任务是计算所有恰好有 $n$ 个有标号顶点的无向简单图的权值之和。请将答案对 $998\,244\,353$ 取模后输出。

注意,简单图是指不允许有重边和自环的无向图。 无向图的连通分量(或简称分量)是一个子图,其中任意两个顶点都通过路径相连,且该子图不与图中的任何其他顶点相连。

输入格式

第一行包含一个整数 $T \le 100$,表示测试数据的组数。

接下来 $T$ 行,每行包含两个空格分隔的整数 $n$ 和 $k$ ($1 \le n \le 10^4$, $1 \le k \le 20$)。

输出格式

对于每组测试数据,输出一行,包含一个整数,表示答案。

样例

输入样例 1

2
3 1
4 2

输出样例 1

12
150

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.