#C3616. Calculate Additional Self-Study Hours

    ID: 47063 Type: Default 1000ms 256MiB

Calculate Additional Self-Study Hours

Calculate Additional Self-Study Hours

You are given a schedule for a week which includes lecture hours and self-study hours for each day. For each test case, two arrays of 7 integers are provided:

  • The first array represents the lecture hours \(L_i\) for day \(i\) (\(1 \leq i \leq 7\)).
  • The second array represents the self-study hours \(S_i\) for day \(i\).

Your task is to compute the difference \(D\) defined as:

\[ D = \sum_{i=1}^{7} L_i - \sum_{i=1}^{7} S_i, \]

If \(D\) is positive, it represents the additional self-study hours required to balance the schedule; if \(D\) is zero, the schedule is already balanced; and if \(D\) is negative, it indicates that there are excess self-study hours compared to the lecture hours.

Write a program that reads input from stdin and outputs the result for each test case to stdout.

inputFormat

The first line of input contains an integer (T) representing the number of test cases. For each test case, there are two lines:

  1. The first line contains 7 space-separated integers representing the lecture hours for each day of the week.
  2. The second line contains 7 space-separated integers representing the self-study hours for each day of the week.

All values are provided on separate lines as described.

outputFormat

For each test case, output a single integer on a new line representing the additional self-study hours required, calculated as (\sum_{i=1}^{7} L_i - \sum_{i=1}^{7} S_i).## sample

2
3 4 5 6 7 8 9
1 2 3 4 5 6 7
10 10 10 10 10 10 10
5 5 5 5 5 5 5
14

35

</p>