Descrição
Our company sells various products and we need to sum both the cost involved as well as the profit in this market. The input data is defined in two matrices, one indicating the products sold per month and another indicating the cost and profit per unit associated with each product. We need to produce a similar matrix containing the aggregate cost of the products sold, together with the profit. The Figure 1 illustrates a case where we have three different pieces and three months, with its result.
Entrada
The input have many test cases. Initially, a N value is informed, indicating the quantity of test cases to be processed. Each test case starts with two integers P (0< P<=20) and M (0<M<=12) indicating, respectively, the quantity of sold products and the months to be considered. Next, two matrices must be read, the first containing M rows with P integers Q (0<=Q<=100), separated by a single white space, indicating the sold products sold in each month and the second containing P rows with two integers C and L (0<=C, L <=25) in each row, indicating respectively the cost and profit by unit of each product.
Saída
For each test case, print the number of the test case, as shown in the examples, followed by the matrix containing M rows, each one with two integers, that represents the total cost and profit of each month.
Exemplos de Entrada | Exemplos de Saída |
---|---|
2 |
Case 1: |
Efetue Login ou Cadastre-se para submeter uma solução.
Criado por Antonio Cesar de Barros Munari (Fatec Sorocaba) | Adaptado por erich.rodriguesf | Competição: Interfatecs 2014 1ª fase