Absolute Forecast Error
Riverbend Supply's demand model guesses how many units of each product line will sell next week. On Monday the buyers put those guesses beside what actually sold. The review sheet records the size of each miss rather than its direction: a line the model overshot by 3 was exactly as wrong as one it undershot by 3, and the buyers do not want the two cancelling each other out when the sheet is totalled later in the month.
Task: Print the size of the miss on each product line.
Input
Three lines. The first holds a single integer n, the number of product lines. The second holds the n predicted figures on one line, separated by single spaces. The third holds the n figures that actually sold, in the same line order.
Output
One line holding n values, in the same order, separated by single spaces, each with two digits after the decimal point. Every value is zero or more, because a miss recorded here has no direction.
Example:
Input:
3
10 20 30
12 18 33
Output:
2.00 2.00 3.00
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