There Are Two Types Of Burgers (Educational Codeforces Round 71)

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.

Input
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.

Output
For each query print one integer — the maximum profit you can achieve.

#include 
#include 
#include 
#include <string>
#include 
#include 
#include 
#include 
#include <set>
#include 
#include 
#include 
using namespace std;
#define pq priority_queue
#define pql priority_queue
#define pqn priority_queue
#define v vector
#define vl vector
#define lson rt<<1, l, m  
#define rson rt<<1|1, m+1, r
#define read(x) scanf("%d",&x)
#define lread(x) scanf("%lld",&x);
#define pt(x) printf("%d\n",(x))
#define yes printf("YES\n");
#define no printf("NO\n");
#define gcd __gcd
#define cn cin>>
#define ct cout<<
#define ed <#define ok return 0 ;
#define over cout<#define rep(j,k) for (int i = (int)(j); i <= (int)(k); i++)
#define input(k) for (int i = 1; i <= (int)(k); i++)  {cin>>a[i] ; }
#define mem(s,t) memset(s,t,sizeof(s))
#define re return 0;
#define TLE std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod(x) ((x)%9973)
#define test cout<<"     ++++++      "<
typedef long long ll;
const int N=150000+5;
const int maxn=10000+5;
const int len = 2*1e5+5;
typedef struct node
{
    int x,y,ankle,T;
}node;
node dp[len]; 
int a[N];
double getlen(node xx,node yy) { return ( (xx.x-yy.x)*(xx.x-yy.x) +(xx.y-yy.y)*(xx.y-yy.y) ); } //计算两点间距离 
int main()
{
    int t,m,n,k,l,r;
    for(cin>>t;t;t--)
    {
        cin>>n>>m>>k>>l>>r;
        n/=2;
        if(l>r)
        {
            if(n>m) cout<endl;
            else cout<endl;
        }
        else if(r>l)
        {
            if(n>k) cout<endl;
            else cout<endl;
        }
        else
        {
            cout<endl;
        }

    }
    ok;
} 

 

你可能感兴趣的:(There Are Two Types Of Burgers (Educational Codeforces Round 71))