???题目6 : Cake
来源:互联网 发布:淘宝卖家移动版 编辑:程序博客网 时间:2024/05/24 06:50
题目6 : Cake
- 样例输入
35 3 43 2 93 4 80
- 样例输出
26
描述
To celebrate that WF-2018 will be held in PKU, Alice, Bob, and Cate are asked to make
N cakes.
Every cake i needs to go through 3 steps in restrict order:
1. Alice mixes flour and water for ai minutes;
2. Bob carefully bakes it for bi minutes;
3. Cate makes cream decoration for ci minutes.
Since Cate wants to have different kinds of cakes, the third step of any cake i is always not less time-consuming than the second step of any cake j. Also, it is reasonable that once anyone starts to process a cake, the procedure cannot be stopped then be resumed.
To have these cakes done as soon as possible, they need your help.
输入
There are several cases (less than 15 cases).
The first line of every case contains an integer N (1 ≤ N ≤ 105)—the number of cakes to prepare.
After that, N lines follow, each of them contains three integers ai, bi and ci (1 ≤ i ≤ N; 0 <ai, bi, ci < 106)—time that needs to be spent on the three steps of cake i respectively.
It is guaranteed that for any i and any j, bi is no greater than cj.
The input ends with N = 0.
输出
For every case, print in a single line the least possible time to make all cakes.
样例提示
One of the optimal solutions is to have Alice and Bob process cakes in order of 2, 3, 1, while Cate processes cakes in order of 2, 1, 3.
比赛已经结束,去题库提交。
- ???题目6 : Cake
- HDOJ 题目1722 Cake(数学)
- cake
- Cake
- Cake
- Cake
- Cake
- Cake
- Cake
- Cake
- cake
- Cake
- Cake
- Cake
- Cake
- Cake
- Cake
- Cake
- 电话悬浮代码
- 左右滚动公告代码
- 几十条业务线日志系统如何收集处理?
- 仿美团菜单代码
- c++入门【菜鸟学习日记】
- ???题目6 : Cake
- 图片可以360度旋转类似广告代码
- 仿网易官网顶部展出的大幅广告代码,附效果演示
- 微信小程序之picker组件
- 前端开发每天必学之HTML入门介绍
- 页面加密代码,附效果演示
- 非常漂亮的纯css3实现多彩侧边导航(非常流畅),附效果演示
- 唯美雪景雪花飘落代码,附效果演示
- 三角形的判断