#abc286d. D - Money in Hand
D - Money in Hand
Score : points
问题描述
Takahashi 拥有 种硬币;具体来说,对于 ,他拥有价值为 日元(日本货币)的每枚硬币共 枚。
判断 Takahashi 是否能够用他当前拥有的硬币精确支付 日元(无需找零)。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Takahashi has kinds of coins; specifically, for , he has coins worth yen (the currency in Japan) each.
Determine if Takahashi can pay exactly yen (without change) with the coins he currently has.
Constraints
- are pairwise distinct.
- All values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print Yes
if Takahashi can pay exactly yen with the coins he currently has; print No
otherwise.
Sample Input 1
2 19
2 3
5 6
Sample Output 1
Yes
Takahashi has three -yen coins and six -yen coins. He can use two -yen coins and three -yen coins to pay exactly yen. Thus, Yes
should be printed.
Sample Input 2
2 18
2 3
5 6
Sample Output 2
No
There is no combination of the coins that he can use to pay exactly yen. Thus, No
should be printed.
Sample Input 3
3 1001
1 1
2 1
100 10
Sample Output 3
Yes
He need not use all kinds of coins.
update @ 2024/3/10 11:57:29