Pointing an Arrow at a Specific Point
Harbourline Retail counts how many people walk into one store, one reading per opening hour. The evening report draws an arrow at the busiest hour, but an arrow on its own tells a duty manager nothing they can act on — the caption beside it has to carry the number and say which hour it belongs to. The chart is drawn for you; the caption line is what you owe.
Task: Print the largest reading and the position it sits at.
Input
The first line holds one integer n, the number of readings. Each of the next n lines holds one reading, a number on its own.
Output
One line: the largest reading, one space, then its position. Positions start at 0, so the first reading sits at position 0. The reading is printed as a plain number, so a whole reading shows as 50.0. If the largest reading appears more than once, report its earliest position.
Example:
Input:
4
10
50
30
20
Output:
50.0 1
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