标题:大虾高手都来看看帮一下忙!求解一道HOJ题目。。。
取消只看楼主
fightingsss
Rank: 6Rank: 6
等 级:侠之大者
帖 子:97
专家分:471
注 册:2010-11-12
结帖率:80%
已结贴  问题点数:20 回复次数:0 
大虾高手都来看看帮一下忙!求解一道HOJ题目。。。
Recently, a shopping mall is making sale promotional activity. If you buy goods worth m yuan or more, they will return you r yuan cash. bailey is so poor that he wants to get r yuan with minimum cost. Please help him.


Input

The first line is an integer c which shows the number of cases. Each case contains 2 lines. The first line has 2 positive integers n and m, n is the number of goods. The second line contains n positive integers which are the price of each goods. You must remember that bailey hates to buy two same goods.(0<n<100, 0<m<1000)


Output

For each case print the minimum cost in a single line.


Sample Input


 2 2 100 50 70 3 100 50 50 70

Sample Output


 120 100
搜索更多相关主题的帖子: Recently return 
2011-05-12 19:49



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-339649-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.132959 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved