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;
    }
    
  • 相关阅读:
    02.创建型————工厂方法模式
    01.创建型————简单工厂模式
    HBase JavaAPI操作示例
    MongoDB
    大数据第三天
    Zookeeper操作
    MR操作
    HDFS操作
    【GISER&&Painter】svg的那些事
    读法克鸡丝博文《技术,产品,团队》有感
  • 原文地址:https://www.cnblogs.com/Repulser/p/11402709.html
Copyright © 2011-2022 走看看