Emphasizing One Slice
Calder & Voss builds one slide per division of a client's business. On each slide a single wedge is pulled slightly clear of the circle so the eye lands on the division being discussed, while the rest stay where they are. The caption spells out that division's share as a percentage, because a wedge that has been moved is even harder to size by eye than one that has not.
Task: Print the highlighted category's share of the total, as a percentage. The total is every value in the list added together — do not assume the values already come to 100. If the same category name appears on more than one line, use the first line carrying it.
Input
The first line holds an integer n, the number of categories. Each of the next n lines holds a category name, one word with no spaces, then its value, separated by a single space. The final line holds the name of the category to highlight, and it always matches at least one of them.
Output
One line with exactly 1 digit after the decimal point, given as a percentage rather than as a fraction. A share of three quarters prints as 75.0, never as 0.8.
Example:
Input:
3
A 50
B 30
C 20
A
Output:
50.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