The Funnel Steps
The funnel slide is the one everybody stares at in Lantern's growth review: how many people reached each stage of signing up, and how badly the crowd thins on the way down. Raw counts hide the shape — losing 600 people means one thing near the top and something else near the bottom — so every stage is quoted against the crowd that entered the funnel in the first place.
Task: Print each step with the percentage of the opening crowd that reached it.
Input
The first line holds an integer n, the number of steps. Each of the next n lines holds a step name and a count separated by a single space. The steps arrive in funnel order, and the counts never rise as you go down.
Output
One line per step, in the order the steps arrived: the name, one space, then a percentage with exactly one digit after the decimal point. The first step always prints 100.0, being its own comparison.
Example:
Input:
3
visit 1000
signup 400
purchase 100
Output:
visit 100.0
signup 40.0
purchase 10.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