OpenJudge

4_D:Sum of the numbers

总时间限制:
1000ms
内存限制:
40000kB
描述

Original,there are N numbers,namely 1,2,3,....N.

then,there have k numbers.a1,a2,a3....ak.you should choose a1-th smallest number and take out,

and then choose a2-th smallest number and take it away,and so on.you task is to giving me the

total sum of the numbers you has taken.

输入
The first line contains a single integer T,indicating the number of test cases.
Each case includes two integers N,k;
the next line have k numbers.
notice:

1.1<=T<100
2.1<=K<=N<=270000
3.1<=ai<=N-i+1
输出
For each test case, output the case number first, then the sum.
样例输入
2
3 2
1 1
10 3
3 9 1
样例输出
Case 1: 3
Case 2: 14
提示
s

3_A :0<A,B<10的6次方

全局题号
5141
添加于
2012-10-14
提交次数
23
尝试人数
6
通过人数
0