Day-over-Day Price Change
Riverbend Supply watches what its competitors charge on a list of tracked items. Every morning the scraper files two rows: what each item cost yesterday, and what the same item costs today, with the items in the same order in both rows. Buyers want the movement item by item, with rises told apart from falls — a rise on a headline item matters far more to them than the drift of the list as a whole.
Task: Print how far each item's price moved between yesterday and today.
Input
Three lines. The first holds a single integer n, the number of tracked items. The second holds yesterday's n prices on one line, separated by single spaces. The third holds today's n prices, on one line, in the same item order.
Output
One line holding n movements in item order, separated by single spaces, each with two digits after the decimal point. An item that got dearer is positive; an item that got cheaper is negative, written with a leading minus sign.
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