#P3423. [POI 2005] BAN-Bank Notes
[POI 2005] BAN-Bank Notes
Description
Byteotian Bit Bank(BBB) has an advanced currency system. There are coin denominations with values . However, each coin has a limited quantity. Now we want to make a total value of . Find the minimum number of coins needed. It is guaranteed that can be formed.
Input Format
The first line contains an integer .
The second line contains integers , the denominations of these types of coins.
The third line contains integers , the quantity of each of these types of coins.
The fourth line contains an integer .
Output Format
The first line contains an integer, the minimum number of coins required.
The second line contains integers, where the -th number is how many coins of type are used.
If there are multiple solutions, output any one of them.
3
2 3 5
2 2 1
10
3
1 1 1
Hint
For of the testdata, , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号