Building a Stacked Bar (Manual Layering)
Tidewater Foods bills each account in two parts, a standing charge and a usage charge. The billing chart shows both parts in one bar per account so the split is visible, and the covering note names the account that costs the most once both parts are counted — which is not always the account with the larger standing charge.
Task: Print the account with the highest combined charge.
Input
The first line holds one integer n, the number of accounts. Each of the next n lines holds an account name, its standing charge and its usage charge, separated by single spaces. Account names contain no spaces and each account appears on exactly one line.
Output
One line holding a single account name, exactly as it was read. An account's combined charge is its two charges added together; neither part alone decides it. If two accounts share the highest combined charge, print whichever appeared first in the input.
Example:
Input:
2
A 10 20
B 25 10
Output:
B
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