#C9895. Minimum Word Edits
Minimum Word Edits
Minimum Word Edits
In this problem, you are given the current word counts and the required word counts for a number of articles. For each article, you can perform edits where one edit changes the word count by one (either adding, removing, or modifying a word). The goal is to compute the minimum number of edits needed for each article to reach the exact required word count. Mathematically, for an article with a current word count ( c ) and a required word count ( r ), the number of edits required is given by: ( |c - r| ). You will be given multiple test cases to process. Each test case contains multiple articles. The result for each test case is the sum of minimum edits required for all articles in that test case.
inputFormat
The input is given via standard input (stdin). The first line contains a single integer ( T ), the number of test cases. Each test case is described as follows:
- The first line contains an integer ( n ), representing the number of articles.
- The second line contains ( n ) space-separated integers, where each integer represents the current word count of an article.
- The third line contains ( n ) space-separated integers, where each integer represents the required word count for the corresponding article.
outputFormat
For each test case, output a single integer representing the total minimum number of word edits needed, each on a new line. The output should be sent to standard output (stdout).## sample
3
3
450 620 512
480 600 500
2
150 350
200 300
1
1
10000
62
100
9999
</p>