eolymp
bolt
Попробуйте наш новый интерфейс для отправки задач

Bribe

After having done a lot of spying and infiltrating a criminal network, you are now ready to try and dismantle it. This, however, requires the cooperation of a certain number of the henchmen. This in turn requires money in order to bribe them, but due to budget cuts, you only have a limited amount of money. Fortunately, you are an excellent judge of character, so for each of the henchmen you are considering to bribe, you know what amount of money they will ask for. Furthermore, you know the probability that they will then successfully convert, as opposed to taking the money and making a run for it. There is no particular rush, so after each attempted conversion you can establish whether it was successful or not, before you move on to someone else. Of course, if it was not successful, then you cannot try to bribe this henchman a second time. Given all this information on the henchmen, the amount of money that you have at your disposal, and the number of henchmen you need to convert, can you work out the probability that this operation will be a success? \includegraphics{https://static.e-olymp.com/content/28/28fa9608d8bbecac176b85694ab9f602f599317c.jpg} \InputFile On the first line one positive number: the number of test cases, at most \textbf{100}. After that per test case: \begin{itemize} \item one line with three space-separated integers \textbf{n}, \textbf{c} and \textbf{m} (\textbf{1} ≤ \textbf{n}, \textbf{c} ≤ \textbf{16} and \textbf{1} ≤ \textbf{m} ≤ \textbf{1000}): the number of henchmen that are susceptible to bribe, the number you need to convert, and the amount of money that you have, respectively. \item \textbf{n} lines with two space-separated integers \textbf{b} and \textbf{p} (\textbf{0} ≤ \textbf{b} ≤ \textbf{1000} and \textbf{0} ≤ \textbf{p} ≤ \textbf{100}): the amount of money you need to bribe each henchman, and the probability (as a percentage) that he will be successfully converted, respectively. \end{itemize} \OutputFile Per test case: \begin{itemize} \item one line with a single floating point number: the probability that you will succeed in converting \textbf{c} henchmen, if you take an optimal approach. This number should be accurate up to \textbf{10^\{-6\}} relative or absolute precision. \end{itemize}
Лимит времени 1 секунда
Лимит использования памяти 64 MiB
Входные данные #1
2
4 3 1000
300 40
300 50
300 60
300 70
4 2 1000
100 80
700 50
400 20
500 20
Выходные данные #1
0.21
0.408
Источник The 2013 Benelux Algorithm Programming Contest, BAPC 2013