CF1207A.There Are Two Types Of Burgers
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
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 b buns, p beef patties and f chicken cutlets in your restaurant. You can sell one hamburger for h dollars and one chicken burger for c dollars. Calculate the maximum profit you can achieve.
You have to answer t independent queries.
你的餐厅里有两种汉堡:牛肉汉堡和鸡肉汉堡!制作一个牛肉汉堡需要两个面包胚和一个牛肉饼;制作一个鸡肉汉堡需要两个面包胚和一个鸡肉排。
你的餐厅中有 b 个面包胚、p 个牛肉饼和 f 个鸡肉排。你可以以每份 h 美元的价格售出一个牛肉汉堡,以每份 c 美元的价格售出一个鸡肉汉堡。请计算你能获得的最大利润。
你需要回答 t 个相互独立的查询。
输入格式
The first line contains one integer t (1≤t≤100) – the number of queries.
The first line of each query contains three integers b, p and f (1≤b, p, f≤100) — the number of buns, beef patties and chicken cutlets in your restaurant.
The second line of each query contains two integers h and c (1≤h, c≤100) — the hamburger and chicken burger prices in your restaurant.
第一行包含一个整数 t(1≤t≤100)—— 表示查询次数。
每次查询的第一行包含三个整数 b、p 和 f(1≤b, p, f≤100)—— 分别表示餐厅中面包片、牛肉饼和鸡肉块的数量。
每次查询的第二行包含两个整数 h 和 c(1≤h, c≤100)—— 分别表示汉堡和鸡肉汉堡的售价。
输出格式
For each query print one integer — the maximum profit you can achieve.
对于每个查询,输出一个整数——你能获得的最大利润。
输入输出样例
输入#1
3 15 2 3 5 10 7 5 2 10 12 1 100 100 100 100
输出#1
40 34 0
说明/提示
In first query you have to sell two hamburgers and three chicken burgers. Your income is 2⋅5+3⋅10=40.
In second query you have to ell one hamburgers and two chicken burgers. Your income is 1⋅10+2⋅12=34.
In third query you can not create any type of burgers because because you have only one bun. So your income is zero.
第一次查询中,您需要卖出两个汉堡和三个鸡肉汉堡。您的收入为 2⋅5+3⋅10=40。
第二次查询中,您需要卖出一个汉堡和两个鸡肉汉堡。您的收入为 1⋅10+2⋅12=34。
第三次查询中,由于您仅有 1 个面包胚,无法制作任何类型的汉堡。因此您的收入为 0。
输入解题思路,AI测评打分。不知道怎么写?