P13491 [CodeChef] kgp14a
NOI
题目描述

Liliputs are holding a drawing competition for K kids, but with K human-sized pencils stolen from humans. In order to make life easier for the kids, the organizers want to give a pencil to each kid in a way such that the sum of the absolute differences of the height of a kid and the length of the pencil assigned to him/her is minimized. What is the minimum sum of absolute differences that can be achieved?

Input
The first line contains the number of test cases N (0 < N ≤ 3).
For each test case, the first line contains the number of kids and pencils K (0 < K ≤ 100). The second line contains K positive integers, each containing the height in millimeter of a kid. The third line contains K positive integers, each containing the length in millimeter of a pencil.

Output
For each test case, print the case number, followed by a colon, followed by a single space, followed by a single integer indicating the minimum sum of absolute differences achieved (in millimeter).

Sample Input

2
5
51 60 51 72 70
65 60 88 72 88
4
123 234 188 175
219 334 122 233

Sample Output

Case 1: 69
Case 2: 190

输入格式

见题面

输出格式

见题面

样例输入
2 5 51 60 51 72 70 65 60 88 72 88 4 123 234 188 175 219 334 122 233
样例输出
Case 1: 69 Case 2: 190