eolymp
bolt
Спробуйте наш новий інтерфейс для відправки розв'язків
Задачі

Euro Efficiency

Euro Efficiency

\includegraphics{https://static.e-olymp.com/content/4b/4b9e93b0d359c6821616dfcdea120a5be5201b59.jpg} On January \textbf{1}^st \textbf{2002}, The Netherlands, and several other European countries abandoned their national currency in favour of the Euro. This changed the ease of paying, and not just internationally. A student buying a \textbf{68} guilder book before January \textbf{1}^st could pay for the book with one \textbf{50} guilder banknote and two \textbf{10} guilder banknotes, receiving two guilders in change. In short: \textbf{50+10+10-1-1=68}. Other ways of paying were: \textbf{50+25-5-1-1}, or \textbf{100-25-5-1-1}. Either way, there are always \textbf{5} units (banknotes or coins) involved in the payment process, and it could not be done with less than \textbf{5} units. Buying a \textbf{68} Euro book is easier these days: \textbf{50+20-2 = 68}, so only \textbf{3} units are involved.This is no coincidence; in many other cases paying with euros is more efficient than paying with guilders. On average the Euro is more efficient. This has nothing to do, of course, with the value of the Euro, but with the units chosen. The units for guilders used to be: \textbf{1}, \textbf{2.5}, \textbf{5}, \textbf{10}, \textbf{25}, \textbf{50}, where as the units for the Euro are: \textbf{1}, \textbf{2}, \textbf{5}, \textbf{10}, \textbf{20}, \textbf{50}. For this problem we restrict ourselves to amounts up to \textbf{100} cents. The Euro has coins with values \textbf{1}, \textbf{2}, \textbf{5}, \textbf{10}, \textbf{20}, \textbf{50} eurocents. In paying an arbitrary amount in the range \[\textbf{1}, \textbf{100}\] eurocents, on average \textbf{2.96} coins are involved, either as payment or as change. The Euro series is not optimal in this sense. With coins \textbf{1}, \textbf{24}, \textbf{34}, \textbf{39}, \textbf{46}, \textbf{50} an amount of \textbf{68} cents can be paid using two coins.The average number of coins involved in paying an amount in the range \[\textbf{1}, \textbf{100}\] is \textbf{2.52}. Calculations with the latter series are more complex, however. That is, mental calculations.These calculations could easily be programmed in any mobile phone, which nearly everybody carries around nowadays. Preparing for the future, a committee of the European Central Bank is studying the efficiency of series of coins, to find the most efficient series for amounts up to \textbf{100} eurocents. They need your help. Write a program that, given a series of coins, calculates the average and maximum number of coins needed to pay any amount up to and including \textbf{100} cents. You may assume that both parties involved have sufficient numbers of any coin at their disposal. \InputFile The first line of the input contains the number of test cases. Each test case is described by 6 different positive integers on a single line: the values of the coins, in ascending order. The first number is always \textbf{1}. The last number is less than \textbf{100}. \OutputFile For each test case the output is a single line containing first the average and then the maximum number of coins involved in paying an amount in the range \[1, \textbf{100}\]. These values are separated by a space. As in the example, the average should always contain two digits behind the decimal point. The maximum is always an integer.
Ліміт часу 1 секунда
Ліміт використання пам'яті 64 MiB
Вхідні дані #1
3
1 2 5 10 20 50
1 24 34 39 46 50
1 2 3 7 19 72
Вихідні дані #1
2.96 5
2.52 3
2.80 4
Джерело ACM ICPC NWERC 2002