#F. Keyence Repetition

    Type: Default 1000ms 256MiB

Keyence Repetition

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Keyence Repetition

题目描述

s s keyence 重复 N N 次形成的字符串。你可以删除任意个字符(可以是0个)形成新的字符串 s s^{\prime}

可以证明有 27N 2^{7N} 个删除方法,你需要找到其中能使 s=t s^{\prime} = t 的方法数,答案对 998244353 998244353 取模。

输入格式

第一行一个整数 NN,第二行一个字符串 tt

输出格式

一行,一个整数,表示满足题意的方法数对 998244353 998244353 取模的值。

样例 #1

样例输入 #1

2
key

样例输出 #1

6

样例 #2

样例输入 #2

2
ccc

样例输出 #2

0

样例 #3

样例输入 #3

100
keyneeneeeckyycccckkke

样例输出 #3

275429980

数据范围

  • 1  N  1018 1\ \leq\ N\ \leq\ 10^{18}
  • 1  t  2.5 × 105 1\ \leq\ |t|\ \leq\ 2.5\ \times\ 10^5 t|t| 代表字符串 tt 的长度
  • t t 是只包含 c, e, k, n, y 的字符串

样例解释 1

s= s= keyencekeyencet= t= key 时,有 6 6 种方法,以下方法中括号内的数字表示保留的位置: $(1,2,3),(1,2,10),(1,4,10),(1,7,10),(1,9,10),(8,9,10)$ 。

20240611集训

Not Attended
Status
Done
Rule
IOI
Problem
6
Start at
2024-6-11 19:00
End at
2024-6-11 21:00
Duration
2 hour(s)
Host
Partic.
14