zoukankan      html  css  js  c++  java
  • CF1207A

    CF1207A-There Are Two Types Of Burgers

    题意:

    出售普通汉堡和鸡肉汉堡,并且两种汉堡所需的原材料价格不同,问最多能卖多少钱。

    解法:

    对于这道题,我们优先考虑先卖贵的。(感觉说了一句废话)
    然后比较面包能做的汉堡数与贵的肉能做的汉堡数,贵的做的越多越,所以较贵的能做 $ min(b,max(p,f)) $ 的。
    如果我们还有剩余的面包,就做便宜的汉堡,便宜的能做面包数与便宜的肉数中较少的值。

    CODE:

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    #include<algorithm>
    #include<cmath>
    
    using namespace std; 
    
    #define LL long long
    const int M = 998244353; 
    
    int n,k,T,b,p,f,h,c,ans; 
    
    int main() {
    	scanf("%d",&T); 
    	while(T--) {
    		scanf("%d%d%d",&b,&p,&f); 
    		scanf("%d%d",&h,&c); 
    		ans = 0; 
    		for(int i = 0; i <= 100; i++)
    			for(int j = 0; j <= 100; j++)
    				if(i * 2 + j * 2 <= b && i <= p && j <= f)
    					ans = max(ans, i * h + j * c); 
    		printf("%d 
    ",ans);
    	}
    	//system("pause");
        return 0;
    }
    
  • 相关阅读:
    STM8s在利用库配置端口的小问题
    ABAP调试
    READ TABLE 的用法
    人在低谷
    力扣 两数之和
    未来选择
    选择
    室友问题该如何解决呢?
    力扣 两数之和
    谈谈自己
  • 原文地址:https://www.cnblogs.com/Repulser/p/11402709.html
Copyright © 2011-2022 走看看