AT_ndpc2026_j.Number and Total

入门

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

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

题目描述

You are given a sequence of positive integers A=(A1,A2,…,AN)A = (A_1, A_2, \dots, A_N) of length NN, and positive integers SS and TT.

Find the number of sequences of non-negative integers (c1,c2,…,cN)(c_1, c_2, \dots, c_N) that satisfy all of the following conditions, modulo 998244353998244353:

  • c1+c2+⋯+cN=Sc_1 + c_2 + \dots + c_N = S
  • A1c1+A2c2+⋯+ANcN=TA_1 c_1 + A_2 c_2 + \dots + A_N c_N = T

给你一个长度为 NN 的正整数序列 A=(A1,A2,…,AN)A = (A_1, A_2, \dots, A_N),以及两个正整数 SS 和 TT。

求满足以下所有条件的非负整数序列 (c1,c2,…,cN)(c_1, c_2, \dots, c_N) 的个数(对 998244353998244353 取模):

  • c1+c2+⋯+cN=Sc_1 + c_2 + \dots + c_N = S
  • A1c1+A2c2+⋯+ANcN=TA_1 c_1 + A_2 c_2 + \dots + A_N c_N = T

输入格式

The input is given from standard input in the following format:

NN SS TT
A1A_1 A2A_2 …\dots ANA_N

输入从标准输入中按以下格式给出:

NN SS TT
A1A_1 A2A_2 …\dots ANA_N

输出格式

Print the number of sequences of non-negative integers (c1,c2,…,cN)(c_1, c_2, \dots, c_N) that satisfy the conditions, modulo 998244353998244353.

输出满足条件的非负整数序列 (c1,c2,…,cN)(c_1, c_2, \dots, c_N) 的个数,对 998244353998244353 取模。

输入输出样例

  • 输入#1

    4 4 10
    1 2 3 4

    输出#1

    5
  • 输入#2

    10 34016955048482281 206283256471036323
    38 35 28 54 3 15 4 16 6 1

    输出#2

    230312634

说明/提示

Sample 1 Explanation:
The following 55 sequences satisfy the conditions:

  • (0,2,2,0)(0,2,2,0)
  • (0,3,0,1)(0,3,0,1)
  • (1,0,3,0)(1,0,3,0)
  • (1,1,1,1)(1,1,1,1)
  • (2,0,0,2)(2,0,0,2)

Constraints

  • 1≤N≤201 \leq N \leq 20
  • 1≤S≤10181 \leq S \leq 10^{18}
  • 1≤T≤10181 \leq T \leq 10^{18}
  • 1≤Ai≤2001 \leq A_i \leq 200
  • ∑i=1NAi≤200\displaystyle \sum_{i=1}^N A_i \leq 200
  • All input values are integers

样例 1 解释:
以下 55 个序列满足条件:

  • (0,2,2,0)(0,2,2,0)
  • (0,3,0,1)(0,3,0,1)
  • (1,0,3,0)(1,0,3,0)
  • (1,1,1,1)(1,1,1,1)
  • (2,0,0,2)(2,0,0,2)

限制条件

  • 1≤N≤201 \leq N \leq 20
  • 1≤S≤10181 \leq S \leq 10^{18}
  • 1≤T≤10181 \leq T \leq 10^{18}
  • 1≤Ai≤2001 \leq A_i \leq 200
  • ∑i=1NAi≤200\displaystyle \sum_{i=1}^N A_i \leq 200
  • 所有输入值均为整数

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

首页