-->
当前位置:首页 > 题库

PROGRAMMING:Make small change

Luz5年前 (2021-05-10)题库354
Han Meimei likes to go shopping all over the world. Now she went to a Mars shop and found that there was a special rule in the shop: you can pay with coins from any planet, but you can't change, and of course you can't be in debt. Han Meimei has $$10 ^ 4 $$coins from various planets on hand. I need you to help her figure out whether it is possible to accurately collect the amount to be paid.
###Input format:
Enter the first line to give two positive integers: $$n $$($$Le 10 ^ 4 $$) is the total number of coins, $$M $$($$$Le 10 ^ 2 $$) is the amount Han Meimei has to pay. The second line gives the positive integer face value of $$n $$coins. Numbers are separated by spaces.
###Output format:
Output the face value of the coin in one line $$V_ 1 \le V_ 2 \le \cdots \le V_ K $$, satisfying condition $$V_ 1 + V_ 2 + ... + V_ k = M$$。 The numbers should be separated by one space, and there should be no extra space at the beginning and end of the line. If the solution is not unique, the minimum sequence is output. If there is no solution, output 'no solution'.
Note: when we say that the sequence {$$a [1], a [2], [cdots $$} is smaller than {$$B [1], B [2], [cdots $$}, it means that there exists $$k [Ge 1 $$such that $$a [i] = B [i] $$holds for all $$I < K $$, and $$a [k] < B [k] $.
###Input sample 1:
```in
8 9
5 9 8 7 2 3 4 1
```
###Output sample 1:
```out
1 3 5
```
###Input example 2:
```in
4 8
7 2 4 3
```
###Output example 2:
```out
No Solution
```







answer:If there is no answer, please comment