topcoder SRM 624 DIV2 CostOfDancing

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

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

  

posted @ 2014-06-13 11:05  OpenSoucre  阅读(118)  评论(0编辑  收藏  举报