#K35437. Temperature Checkpoint Differences
Temperature Checkpoint Differences
Temperature Checkpoint Differences
You are given the temperatures at m checkpoints before and after a heatwave. The original temperatures are provided for context, but your task is to compute the differences between consecutive checkpoints from the new temperatures. For each consecutive pair, compute the difference as:
$$d_i = new\_temps_{i+1} - new\_temps_{i}$$
If there is only one checkpoint (m = 1), then no difference can be calculated, and the output should be empty.
inputFormat
The input is given via stdin and has the following format:
m original_temp_1 original_temp_2 ... original_temp_m new_temp_1 new_temp_2 ... new_temp_m
Here, m is an integer representing the number of checkpoints. The second line contains m integers representing the original temperatures, and the third line contains m integers giving the new temperatures recorded after the heatwave.
outputFormat
Output via stdout a single line consisting of m-1 integers. Each integer is the difference between two consecutive new temperatures. The differences should be separated by a single space. If there are no differences (i.e. when m = 1), output an empty line.
## sample4
2 6 7 10
5 9 10 12
4 1 2