8659: The Alchemist of the Discrete Mathematics

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

题目描述

As a great alchemist, Sophie learns Discrete Mathematics very well.

One day, Sophie finds a magic prime number pp. From her grandma's teaching, if a polynomial F(x) satisfying that F(x)0(modp) has a solution, then the polynomial is mysterious.

To understand the property of mysterious polynomials, Sophie studies the roots of polynomial.

Given integer n, prime number pp and parameter pcFp, the set SFp is good, if there exist polynomial f(x),g(x)Fp[x] satisfying

  1. deg(f)=n
  2. g(x)\mid f(x)g(x)f(x), i.e., g(x)g(x) divides f(x)f(x)
  3. Call T the set of roots of polynomial h(x) = (x)g(cx), then S=TFp

Sophie wonders the number of good sets given n,p and c. Since the answer may be too large, you should output the answer modulo 998244353

If you are not familiar with those notations, please refer to the ``Notes section'' in the pdf statement for formal definition.

输入格式

The first line contains an integer T1), denoting the number of test cases.

For each test case, there is a line containing three integers p,c,n(1c<p5105,0n106), whose meaning is already given in the previous statement.

It is guaranteed that the sum of p over all test cases won't exceed 10^7.

输出格式

For each test case, output an integer in a line, denoting the answer taken modulo 998244353

输入样例 复制

2
3 2 2
5 4 2

输出样例 复制

8
23