A Stacked Bar of Two Segments
Alderwood Supply's regional review charts each store as one bar built from two segments: online sales at the bottom and in-store sales sitting on top of them. Stacked this way the height of a whole bar is the store's total, which is the number the regional manager cares about, while the split inside each bar still shows where the trade came from. Under the chart the review names the strongest store by that total. If two stores tie on the combined figure, the one listed first in the file is named.
Task: Print the store with the highest combined sales.
Input
The first line holds an integer n, the number of stores. Each of the next n lines holds a store name, its online sales and its in-store sales, separated by single spaces. A name contains no spaces.
Output
One line holding the name of the store with the largest online-plus-in-store total, spelled exactly as in the input.
Example:
Input:
2
A 50 30
B 20 20
Output:
A
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