Submit | All submissions | Best solutions | Back to list |
DNEQ - Denver and Emma |
Denver really likes Emma and he wants to impress her but Emma only like those boys who are good in problem solving. So Emma gave a problem to Denver and told him that she will only be impressed by him if he is able to solve the problem. As Denver is very bad in problem solving so he wants your help him. The problem statement is...
There are N men and their weight is increased by A kg each, when one of the men whose weight is B kg is replaced by a new man so you need to find the weight of new men.
Input
The first line of the input consist of a single integer number t which determines the number of test cases.
In each of next t lines there are three integer number N, A and B denoting the number of men which is N, the weight increased by A amount and the weight of the men which is replaced i.e. B kg.
Constraints
- 1 ≤ t ≤ 10
- 1 ≤ N ≤ 102
- 1 ≤ A ≤ 99
- 1 ≤ B ≤ 99
Example
Input: 2 8 1.5 65 6 3 80 Output: 77 98
Explanation:
In test case 1st there are 8 men and their weight is increased by 1.5kg so total weight increased = (8 × 1.5)kg = 12kg
The weight of the new men = (12 + 65) = 77kg.
Added by: | Samar |
Date: | 2021-05-11 |
Time limit: | 2s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |