排个序,求前k个元素和即可
int minimum(int K, vector <int> danceCost)
{
sort(danceCost.begin(),danceCost.end());
return accumulate(danceCost.begin(),danceCost.begin()+K,0);
}
排个序,求前k个元素和即可
int minimum(int K, vector <int> danceCost)
{
sort(danceCost.begin(),danceCost.end());
return accumulate(danceCost.begin(),danceCost.begin()+K,0);
}