Closest Sums

题目描述

[problemUrl]: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=16&page=show_problem&problem=1428 [PDF](https://uva.onlinejudge.org/external/104/p10487.pdf) ![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10487/2a3aff6046df33aebfef09dd5e9bef3cecfda77e.png)

输入输出格式

输入格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10487/771bbccc31d97d84ba3fbcbff50637e4e5fffc57.png)

输出格式


![](https://cdn.luogu.com.cn/upload/vjudge_pic/UVA10487/6967a4547e56a49d16eee5a4115e61bd1d72c72c.png)

输入输出样例

输入样例 #1

5
3
12
17
33
34
3
1
51
30
3
1
2
3
3
1
2
3
3
1
2
3
3
4
5
6
0

输出样例 #1

Case 1:
Closest sum to 1 is 15.
Closest sum to 51 is 51.
Closest sum to 30 is 29.
Case 2:
Closest sum to 1 is 3.
Closest sum to 2 is 3.
Closest sum to 3 is 3.
Case 3:
Closest sum to 4 is 4.
Closest sum to 5 is 5.
Closest sum to 6 is 5.