Greedy:Yogurt factory(POJ 2393)】的更多相关文章

酸奶工厂 题目大意:酸奶工厂每个星期都要制造酸奶,成本每单位x,然后每个星期要生产y,然后酸奶厂有个巨大的储存室,可以无限储存酸奶,而且酸奶的品质不会变坏,每天储存要每单位花费S,求最小的成本. 简直是初中生数学题,贪心法即可,假如当前酸奶成本是X,则如果储存酸奶,则下k个星期的(如果还使用这批酸奶),则成本为x+k*s,对比k个星期的成本就可以确定用哪个了. 水题 #include <iostream> #include <functional> #include <alg…
http://poj.org/problem?id=2393 Yogurt factory Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7341   Accepted: 3757 Description The cows have purchased a yogurt factory that makes world-famous Yucky Yogurt. Over the next N (1 <= N <= 10…
Yogurt factory Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8205   Accepted: 4197 Description The cows have purchased a yogurt factory that makes world-famous Yucky Yogurt. Over the next N (1 <= N <= 10,000) weeks, the price of milk…
Description The cows have purchased a yogurt factory that makes world-famous Yucky Yogurt. Over the next N (1 <= N <= 10,000) weeks, the price of milk and labor will fluctuate weekly such that it will cost the company C_i (1 <= C_i <= 5,000) c…
POJ 2393 题意: 每周可以生产牛奶,每周生产的价格为Ci,每周需要上交的牛奶量Yi,你可以选择本周生产牛奶,也可选择提前几周生产出存储在仓库中(仓库无限大,而且保质期不考虑),每一周存仓库牛奶需要花费S元,让你求出所有周的需求量上交的最少花费. 分析: 因为第 i 周的奶酪,可以在第 i 周生产,也可以在前几周生产,然后储存.通过把s转化为花费,跟原有花费去比较,取一个最小值,这样从头到尾,每一周都可以取得一个花费的最小值.贪心求解. #include<cstdio> #include…
2393:Yogurt factory 总时间限制:  1000ms 内存限制:  65536kB 描述 The cows have purchased a yogurt factory that makes world-famous Yucky Yogurt. Over the next N (1 <= N <= 10,000) weeks, the price of milk and labor will fluctuate weekly such that it will cost th…
1680: [Usaco2005 Mar]Yogurt factory Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 106  Solved: 74[Submit][Status][Discuss] Description The cows have purchased a yogurt factory that makes world-famous Yucky Yogurt. Over the next N (1 <= N <= 10,000)…
1740: [Usaco2005 mar]Yogurt factory 奶酪工厂 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 119  Solved: 100[Submit][Status][Discuss] Description The cows have purchased a yogurt factory that makes world-famous Yucky Yogurt. Over the next N (1 <= N <= 10…
The cows have purchased a yogurt factory that makes world-famous Yucky Yogurt. Over the next N (1 <= N <= 10,000) weeks, the price of milk and labor will fluctuate weekly such that it will cost the company C_i (1 <= C_i <= 5,000) cents to prod…
Description The cows have purchased a yogurt factory that makes world-famous Yucky Yogurt. Over the next N (1 <= N <= 10,000) weeks, the price of milk and labor will fluctuate weekly such that it will cost the company C_i (1 <= C_i <= 5,000) c…