Two Histograms, Two Subplots
Bramley Foods runs two bottling lines, A and B, and Ashgrove Analytics checks the fill weights coming off each. The two sets of weights are drawn in separate panels rather than layered on one set of axes — a panel is simply one chart inside a figure holding several, and keeping them apart means a tall bar in one can never be mistaken for a bar in the other. What the shift supervisor actually reads is the pair of figures printed underneath.
Task: Print the spread of line A's weights, followed by the spread of line B's weights. A line's spread is its heaviest fill minus its lightest.
Input
Four lines. The first holds an integer n, how many weights came off line A. The second holds those n weights separated by single spaces. The third holds an integer m for line B, and the fourth holds its m weights. Weights may have decimals. Both n and m are at least 1.
Output
Two lines: line A's spread first, line B's second, each with exactly 1 digit after the decimal point. A spread of two prints as 2.0.
Example:
Input:
3
10 20 30
3
5 15 45
Output:
20.0
40.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