问题 A: Count

内存限制:64 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:3 通过:3

题目描述

You are given three positive integers nm, and k.

Your task is to calculate the total number of sequences A of length n that satisfy the following conditions:

  1. All elements of A are integers from 11 to m(inclusive).
  2. Let Ai be the i-th element of sequence A. For all positive integers i not exceeding k, it is satisfied thatAi=Ank+i.

Calculate the total number of such sequences A that satisfy the conditions and output the result modulo 998244353.

输入格式

The first line contains an integer TT1000, representing the number of test cases.

Each of the next T lines contains three integers nm, and k1n,m,k1018,kn, representing the parameters for one test case.

输出格式

For each test case, output an integer representing the answer.

输入样例 复制

1
11 2 1

输出样例 复制

1024

分类标签