topcoder SRM 624 DIV2 CostOfDancing

OpenSoucre發表於2014-06-13

排個序,求前k個元素和即可

    int minimum(int K, vector <int> danceCost)
    {
        sort(danceCost.begin(),danceCost.end());
        return accumulate(danceCost.begin(),danceCost.begin()+K,0);
    }

  

相關文章