yukicoder-137

从 Trac 迁移的文章

这是从旧校内 Wiki 迁移的文章,可能存在一些样式问题,您可以向 memset0 反馈。

原文章内容如下:

{{{
#!html
<script type="text/x-mathjax-config">MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});</script>
<script type="text/javascript" async src="http://10.71.10.90/sfiction/tool/MathJax/MathJax-master/MathJax.js?config=TeX-MML-AM_CHTML"></script>
<style>
.input, pre {
    display: block;
    padding: 9.5px;
    margin: 0 0 10px;
    font-size: 13px;
    line-height: 1.42857143;
    color: #333;
    word-break: break-all;
    word-wrap: break-word;
    background-color: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 4px;
}
</style>
}}}

== [https://yukicoder.me/problems/no/137 No.137 貯金箱の焦り] ==

=== Description ===

{{{
#!html
<p>有$N$种货币,第$i$种的面值是$A_i$。每种货币都有无限个,问有多少种方式能够组成$M$元。方案数对$1234567891$取模。两种方案不同当且仅当存在一种货币使用的个数不同。</p>
}}}

=== Input ===

{{{
#!html
<p class="input">
$N$ $M$<br>
$A_1$ $A_2$ $\cdots$ $A_N$
</p>
<p>
$1 \le N \le 50, 1 \le M \le 10^{18}, 1 \le A_1 < A_2 < \cdots < A_N \le 500$。
</p>
}}}

=== Output ===

{{{
#!html
<p>输出方案数对$1234567891$取模。</p>
}}}

=== Sample ===

==== Sample 1 ====
输入
{{{
#!html
<pre>
6 13
1 5 10 50 100 500
</pre>
}}}
输出
{{{
#!html
<pre>
4
</pre>
}}}

==== Sample 2 ====
输入
{{{
#!html
<pre>
2 2015
47 53
</pre>
}}}
输出
{{{
#!html
<pre>
0
</pre>
}}}

==== Sample 3 ====
输入
{{{
#!html
<pre>
4 1000000000000000000
5 8 58 85
</pre>
}}}
输出
{{{
#!html
<pre>
48489055
</pre>
}}}

No.137 貯金箱の焦り

Description

有$N$种货币,第$i$种的面值是$A_i$。每种货币都有无限个,问有多少种方式能够组成$M$元。方案数对$1234567891$取模。两种方案不同当且仅当存在一种货币使用的个数不同。

Input

$N$ $M$
$A_1$ $A_2$ $\cdots$ $A_N$

$1 \le N \le 50, 1 \le M \le 10^{18}, 1 \le A_1 < A_2 < \cdots < A_N \le 500$。

Output

输出方案数对$1234567891$取模。

Sample

Sample 1

输入

6 131 5 10 50 100 500

输出

4
Sample 2

输入

2 201547 53

输出

0
Sample 3

输入

4 10000000000000000005 8 58 85

输出

48489055