[POI2005]BAN-Bank Notes

题目描述

The Byteotian Bit Bank (BBB) has the largest network of cash dispensers in the whole Byteotia. The BBB have decided to improve their dispensers and have asked you for help. The legal tender in Byteotia are bank notes of denominations $b_1,b_2,\cdots,b_n$. The BBB have concluded that the cash dispensers are to pay every sum in the smallest possible total number of notes. TaskWrite a programme that: reads from the standard input the description of the dispenser's notes stock and the sum to be paid off,determines the minimal total number of bank notes sufficient to pay the desired sum off, and finds some way of paying it off as well (using the determined minimal number of notes, of course)writes the result to the standard output. Byteotian Bit Bank (BBB) 拥有一套先进的货币系统,这个系统一共有n种面值的硬币,面值分别为b1, b2,…, bn. 但是每种硬币有数量限制,现在我们想要凑出面值k求最少要用多少个硬币.

输入输出格式

输入格式


In the first line of the standard input the number of denominations is written $n$, $1\le n\le 200$. The second line contains $n$ integers $b_1,b_2,\cdots,b_n$, $1\le b_1

输出格式


The first line of the standard output should contain one integer denoting the minimal total number of bank notes sufficient to pay the sum off $k$. The second line should contain $n$ integers, separated by single spaces, denoting the numbers of notes of subsequent denominations used to pay off the sum $k$. If there are many solutions your programme should write any of them.

输入输出样例

输入样例 #1

3
2 3 5
2 2 1
10

输出样例 #1

3
1 1 1