F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

graph

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 153    Accepted Submission(s): 42


Problem Description
An undirected simple graph G can be divided into some connected components. Let x be the number of trees among these components, graph G's value is defined as x^k.

Given n and k, your task is to calculate the sum of values of all undirected simple graphs with exactly n vertices.

Print the answer module 998244353.

*Simple graph : A simple graph is an undirected graph in which both multiple edges and loops are disallowed.

*Connected component : In graph theory, a connected component (or just component) of an undirected graph is a subgraph in which any two vertices are connected to each other by paths, and which is connected to no additional vertices in the supergraph.
 

Input
The first line contains an integer T <= 100, denoting the number of testcases.

T lines follow. Each line contains two space-seperated integers n <= 10000 and k <= 20.
 

Output
For each testcase, print a single line containing the answer.
 

Sample Input
2 3 1 4 2
 

Sample Output
12 150
 

Author
ѧ¾üÖÐѧ
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-30 04:24:43, Gzip enabled