Changing the Aggregation With estimator
Tidewater Foods runs promotions under short codes, and finance wants the money each code brought in — a total, not an average, because a code used once for a large order matters as much as one used ten times for small ones. The chart shows totals per code, and the reconciliation line underneath carries the figure for code A on its own.
Task: Print the total value recorded against code A.
Input
The first line holds one integer n, the number of orders. Each of the next n lines holds a promotion code and one value, separated by a single space. Codes contain no spaces, and a code may appear on many lines or on none.
Output
One line holding the total of every value recorded against the code A, with exactly two decimal places. Codes are matched exactly as written, so a is a different code from A. If no line carries code A, print 0.00.
Example:
Input:
4
A 10
A 20
B 100
A 5
Output:
35.00
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