The Percentage Miss
Northwind's category managers cannot compare crates across lines. Ten crates missed on bottled water is a rounding error; ten missed on saffron is a disaster. The board wants the forecast error restated so that every line speaks the same language, with each day's miss judged against the demand that day actually saw.
Task: Print the average percentage miss.
Input
The first line holds an integer n, the number of days. Each of the next n lines holds two numbers separated by a single space: the true demand first, the forecast second. No true demand is ever zero.
Output
One line: a percentage with exactly one digit after the decimal point. Each day's miss is sized against that same day's true demand, and the days then count equally however large or small they were. Direction does not matter. Print 0.0 when every forecast was exact.
Example:
Input:
3
100 90
200 220
50 45
Output:
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