Comparing Variability Across Two Scales
Whetcode Precision runs two CNC machines. Machine A cuts a small bracket to a target of roughly 12 mm; machine B cuts a larger housing to a target of roughly 52 mm. Maintenance can only be booked for one of them this month. The spec both parts are held to is a percentage tolerance — a part may miss its target by a fixed fraction of its own size, not by a fixed number of millimetres — so the question is not which machine wobbles more in absolute terms, but which wobbles more relative to what it is trying to cut.
The same number of finished parts is measured off each machine. In both cases that is the complete run for the month, not a sample. The plant has more than one pair of machines to choose between, so the comparison is rerun with whatever measurements come in.
Task: Work out each machine's coefficient of variation — its spread taken relative to its own mean — using the population standard deviation, and print the letter of the machine with the higher one: A or B, on its own, with no quotes around it.
Input
Three lines. The first holds one integer n, the number of parts measured off each machine (at least 2). The second holds machine A's n measurements in mm, separated by spaces. The third holds machine B's n measurements, in the same form. No machine's measurements average to zero, and the two coefficients are never equal.
Output
One line holding a single letter, A or B, with no quotation marks.
Example:
Input:
8
10 12 11 13 12 11 14 12
50 52 51 53 52 51 54 52
Output:
A
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