欢迎来到起遇信息学
起遇信息学正处于上线筹建阶段,以下功能已全部开放免费体验: ✅ 完整题库浏览与代码提交评测(C / C++ / Python / Java 等) ✅ 入门到进阶的系列课程试读、作业与考试 ✅ AI 提示、AI 作业分析等智能助教功能 ✅ 赛事模拟与个人能力报告 ✅ 邮箱注册开放 ⏳ 付费课程订阅与微信/支付宝支付通道 ⏳ 手机号登录,微信扫码登录、微信公众号绑定 使用中如遇任何问题,欢迎通过页面底部 **"联系我们"** 与我们沟通。
CF1207A.There Are Two Types Of Burgers
There Are Two Types Of Burgers
There are two types of burgers in your restaurant — hamburgers and chicken burgers! To assemble a hamburger you need two buns and a beef patty. To assemble a chicken burger you need two buns and a chicken cutlet.
You have buns, beef patties and chicken cutlets in your restaurant. You can sell one hamburger for dollars and one chicken burger for dollars. Calculate the maximum profit you can achieve.
You have to answer independent queries.
Input
The first line contains one integer () – the number of queries.
The first line of each query contains three integers , and () — the number of buns, beef patties and chicken cutlets in your restaurant.
The second line of each query contains two integers and () — the hamburger and chicken burger prices in your restaurant.
Output
For each query print one integer — the maximum profit you can achieve.
Note
In first query you have to sell two hamburgers and three chicken burgers. Your income is .
In second query you have to ell one hamburgers and two chicken burgers. Your income is .
In third query you can not create any type of burgers because because you have only one bun. So your income is zero.
Samples
3
15 2 3
5 10
7 5 2
10 12
1 100 100
100 100
40
34
0
在线编程 IDE
建议全屏模式获得最佳体验
| 进入全屏编程 | Alt+E |
| 递交评测 | Ctrl+Enter |
| 注释/取消注释 | Ctrl+/ |
| 缩放字体 | Ctrl+滚轮 |