SRM 600 div 2 T 1

Posted wjnclln

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SRM 600 div 2 T 1相关的知识,希望对你有一定的参考价值。

 
贪心+枚举
#include <bits/stdc++.h>
using namespace std;

 

class TheShuttles {
public:
int getLeastCost( vector <int> cnt, int baseCost, int seatCost );
};
int Maxn1,MAXN1;
int TheShuttles::getLeastCost(vector <int> cnt, int baseCost, int seatCost) {
    for (int i = 0; i < cnt.size(); i ++){
        Maxn1 = max(Maxn1, cnt[i]);
    }
    for (int i = 1; i <= Maxn1; i ++){
        int sum = 0;
        for (int j = 0; j < cnt.size(); j ++){
            sum = ((cnt[j] - 1) / i + 1) + sum;
        }
        if ((i * seatCost + baseCost) * sum < MAXN1)
            MAXN1 = (i * seatCost + baseCost) * sum;
    }
    return MAXN1;
}

以上是关于SRM 600 div 2 T 1的主要内容,如果未能解决你的问题,请参考以下文章

topcoder srm 370 div1

topcoder srm 430 div1

topcoder srm 663 div1 -23

topcoder srm 625 div1

Topcoder口胡记 SRM 562 Div 1 ~ SRM 592 Div 1

Topcoder SRM 744 (Div.1 + Div.2)