Hatena::Grouptopcoder

TopCoderの問題を解く

解いた問題の一覧表

2009-05-11

WidgetRepairs

| 18:51

問題文

229.90->249.41 / 250

何日働く必要があるのかを求める。

class WidgetRepairs {
public:
    int days(vector <int> arrivals, int numPerDay) {
        int days = 0;
        int remain = 0;
        for (int i = 0; i < arrivals.size(); i++) {
            remain += arrivals[i];
            if (remain > 0)
                days++;
            remain = max(0, remain-numPerDay);
        }
        if (remain > 0)
            days += (remain-1)/numPerDay + 1;
        return days;
    }
};

MissyMissy2011/07/22 16:09Now I know who the brainy one is, I'll keep looknig for your posts.

zrwuybrcsgozrwuybrcsgo2011/07/23 22:08xDBJGa , [url=http://ngbsklytunqc.com/]ngbsklytunqc[/url], [link=http://olpwwtwjhupr.com/]olpwwtwjhupr[/link], http://vfyjnrgeopbs.com/

qbqmjjqbqmjj2011/07/24 21:58F1VCcA <a href="http://iyopswirddsc.com/">iyopswirddsc</a>