問題一覧 > 通常問題

No.1929 Exponential Sequence

レベル : / AI推定難易度 : 1225 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 78
作問者 : null / テスター : とりゐ
お気に入りにしたユーザー ProblemId : 7179 / 自分の提出
問題文最終更新日: 2022-04-25 18:01:14
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 342 (順位表) の他の問題:

Problem Statement

You are given an integer sequence $\{a_i \}$ of length $n$ and a positive integer $S$.

Count the integer sequences $\{k_i \}$ of length $n$ that satisfy the following conditions.

  • $1 \le k_i$ for all $i$
  • $\displaystyle\sum_{i=1}^{n} {a_i}^{k_i} \le S$

Constraints

  • $1 \le n \le 8$
  • $2 \le S, a_i \le 10^9$
  • All inputs are integers.

Input

$n\ S$
$a_1\ a_2\ \dots a_n$

Output

Output the answer, followed by a newline.

Sample

Sample 1
Input
3 21
2 3 4
Output
7

Only $\{k_1, k_2, k_3\} = \{ 1, 1, 1 \}, \{ 1, 1, 2\}, \{ 1, 2, 1 \}, \{2, 1, 1\}, \{2, 2, 1 \}, \{3, 1, 1 \}, \{3, 2, 1 \}$ satisfy the conditions.

Sample 2
Input
4 124
13 133 1333 13333
Output
0

The answer may be $0$.

Sample 3
Input
5 1000000000
65536 2 37 382759279 15
Output
1009

Sample 4
Input
8 1000000000
2 2 2 2 2 2 2 2
Output
481891820460

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。