



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Definition of the Problem
Typology: Slides
1 / 5
This page cannot be seen from the preview
Don't miss anything!




Nikhil wants to repay his debts to Sita but would like to do so using only highest denominations possible. Once he has decided to use a denomination, he wants to use as many notes/coins of that denomination as possible. Amounts to be paid are given as numbers with two decimal places. Available denominations are given in an array.
source: http://www.codechef.com/problems/KAN13G
The first line of the input will contain the number of test cases, T. The first line of each test case will contain 2 integers N and M denoting respectively the number of denomination values and the number of scenarios on that test case. Next line will contain the N denominations. Note that, a denomination can be either an integer x or a fractional number y, with exactly 2 digits after the decimal point and a zero (0) before the decimal point. It is guaranteed that there will always be a denomination of value 1 and 0.01. Then there will be M numbers in the next line. Each of these numbers z can either be an integer or a decimal number with exactly 2 digits after the decimal point (i.e. 100.50, 55.01). Each number represents the amount owed by Nikhil in the respective scenario