No.1395 Less Sweet Alchemy
タグ : / 解いたユーザー数 234
作問者 :
evima
/ テスター :
夕叢霧香(ゆうむらきりか)
Problem Statement
Runrun likes chocolate with a cacao content of $X$ %.
You have a sufficient amount of each chocolate with cacao contents $C_1$ %, $\ldots$, $C_N$ %.
Determine whether it is possible to make chocolate with a cacao content of $X$ % by mixing appropriate amounts of these.
Formal statement: Determine whether there exists a sequence of non-negative real numbers $a_1, \ldots, a_N$ satisfying the following expression (★).
(★) $\sum_{i=1}^{N} C_i a_i = X \sum_{i=1}^{N} a_i > 0$
Input
$N\ X$ $C_1\ C_2\ \cdots\ C_N$
- $1 \leq N \leq 99$
- $1 \leq X \leq 99$
- $1 \leq C_1 < \ldots < C_N \leq 99$
- All values in the input are integers.
Output
Print Yes if it is possible to make chocolate with a cacao content of $X$ %, and No otherwise, followed by a newline.
Sample
Sample 1
Input
3 75 50 60 95
Output
Yes
For example, mixing $100$ grams of $50$ % cacao chocolate, $100$ grams of $60$ % chocolate, and $200$ grams of $95$ % chocolate makes $400$ grams of $75$ % chocolate.
Sample 2
Input
1 99 1
Output
No
This seems to be some other substance rather than chocolate.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。