CF1310E.Strange Function

省选/NOI-

通过率:0%

时间限制:2.00s

内存限制:512MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Let's define the function ff of multiset aa as the multiset of number of occurences of every number, that is present in aa.

E.g., f(5,5,1,2,5,2,3,3,9,5)=1,1,2,2,4f({5, 5, 1, 2, 5, 2, 3, 3, 9, 5}) = {1, 1, 2, 2, 4}.

Let's define fk(a)f^k(a), as applying ff to array aa kk times: fk(a)=f(fk−1(a)),f0(a)=af^k(a) = f(f^{k-1}(a)), f^0(a) = a.

E.g., f2(5,5,1,2,5,2,3,3,9,5)=1,2,2f^2({5, 5, 1, 2, 5, 2, 3, 3, 9, 5}) = {1, 2, 2}.

You are given integers n,kn, k and you are asked how many different values the function fk(a)f^k(a) can have, where aa is arbitrary non-empty array with numbers of size no more than nn. Print the answer modulo 998 244 353998\,244\,353.

我们定义多重集 aa 的函数 ff 为:对 aa 中每个出现的数,统计其出现次数,所得所有出现次数构成的多重集。

例如,f(5,5,1,2,5,2,3,3,9,5)=1,1,2,2,4f({5, 5, 1, 2, 5, 2, 3, 3, 9, 5}) = {1, 1, 2, 2, 4}。

我们定义 fk(a)f^k(a) 为将函数 ff 对数组 aa 连续应用 kk 次:fk(a)=f(fk−1(a))f^k(a) = f(f^{k-1}(a)),且规定 f0(a)=af^0(a) = a。

例如,f2(5,5,1,2,5,2,3,3,9,5)=1,2,2f^2({5, 5, 1, 2, 5, 2, 3, 3, 9, 5}) = {1, 2, 2}。

给定整数 n,kn, k,你需要计算:当 aa 取遍所有长度不超过 nn 的非空数组(元素为任意整数)时,函数 fk(a)f^k(a) 最多能取多少个不同的值?答案对 998 244 353998\,244\,353 取模。

输入格式

The first and only line of input consists of two integers n,kn, k (1≤n,k≤20201 \le n, k \le 2020).

输入仅有一行,包含两个整数 n,kn, k(1≤n,k≤20201 \le n, k \le 2020)。

输出格式

Print one number — the number of different values of function fk(a)f^k(a) on all possible non-empty arrays with no more than nn elements modulo 998 244 353998\,244\,353.

输出一个数字——即对所有长度不超过 nn 的非空数组,函数 fk(a)f^k(a) 所能取到的不同值的个数,结果对 998 244 353998\,244\,353 取模。

输入输出样例

  • 输入#1

    3 1

    输出#1

    6
  • 输入#2

    5 6

    输出#2

    1
  • 输入#3

    10 1

    输出#3

    138
  • 输入#4

    10 2

    输出#4

    33

输入解题思路,AI测评打分。不知道怎么写?

首页