By Julio Cesar Ceron, URI Oline Judge Brazil
Every year during Christmas season, Santa Claus has the important and difficult task of delivering thousands of gifts to all the children around the world. What no one knows is that he developed an effective way to be able to deliver all the presents before Christmas is over, and that way is a plethora of sleds around the globe simultaneously delivering all the gifts. This way is much easier to complete deliveries, but because there is an enormous number of gifts to be delivered, Santa always has difficulties in knowing how many sleds he will provide for each lot of gifts. Santa has a list with the number of gifts each batch containing the present name and its weight, and he also knows the carrying capacity of each sled. Knowing this information, every year, Santa asks help from a student to develop a program that can help him know how many sleds will be required for each lot.
Your task is to develop a program that stores a number of gifts of a lot, each gift is stored with the name of the toy and its respective weight in Kilograms (consider two digits after decimal point), after that you will have the capacity of each sled, and after you will have the order list wich contains the name of the gift and its amount, done that you should calculate the total weight of the gift and determine how many sleds will be required to make the delivery.
The first line contains an integer Y indicating the amount of test cases, followed by an integer T (0 < T <1000) corresponding to the number of gifts in the batch, after you must readf the gift list, a string N with the gift name and a floating point value K (0 < K ≤ 100) that corresponds to the weight in kilograms of it, the name and weight will be on separate lines. After entering all T gifts the next value is a floating point value M (0 < M ≤ 100) corresponding to the sled carrying capacity in kilograms, consider two digits after decimal point. After inserting the M value the next part is the list containing X applications as follows, a string P corresponding to the gift name, the next line an integer value J (0 < J ≤ 100) representing the quantity of each gift. This list just ends when a "-" is read for the gift name and "0" for the gift weight.
In the first line of output should be informed of the total weight of all gift in the wish list, with two places after the decimal point. In the second line will be told the number of sleds necessary to get the gifts on the wish list. If inserted in the request list a gift that is not in the batch list of toys, the following message should be printed “NAO LISTADO: ” followed by this name.
Leave a blank line after printing each test case.
|Input Samples||Output Samples|
Peso total: 734.00 kg
NAO LISTADO: Boneco do Homem Aranha