Stacked Bars With a Total Line on Top
Kestrel Freight bills each customer in two parts, a base fee and a surcharge. The billing chart puts the two parts on one bar per customer so the split is visible, and runs a line across the top showing how the money accumulates as you read left to right. The invoice footer needs the one number that line finishes at.
Task: Print the grand total across every customer and both parts.
Input
The first line holds one integer n, the number of customers. Each of the next n lines holds a customer name, that customer's base fee and that customer's surcharge, separated by single spaces. Names contain no spaces.
Output
One line holding the grand total as a plain number. Because the amounts are read as decimals, a whole total prints with one decimal place, for example 55.0.
Example:
Input:
3
A 10 5
B 20 10
C 5 5
Output:
55.0
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in