CF1207A There Are Two Types Of Burgers

Posted lyt020321

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CF1207A There Are Two Types Of Burgers相关的知识,希望对你有一定的参考价值。

技术图片
技术图片

代码

#include <bits/stdc++.h>

using namespace std ;
int T , b , p , f , h , c , ans ;
int main () 
    cin >> T ;
    while(T --) 
        ans = 0 ;
        cin >> b >> p >> f >> h >> c ;
        if(h > c) 
            int rest = min(b/2,p) ;
            ans += rest * h ;
            b -= rest*2 ;
            
            if(b >= 2) 
                rest = min(b/2,f) ;
                ans += rest * c ;
            
            cout << ans << endl ;
        else 
            int rest = min(b/2,f) ;
            ans += rest * c ;
            b -= rest*2 ;
            rest = min(b/2,p) ;
            ans += rest * h ;
            cout << ans << endl ;
        
    
    return 0 ;

溜了溜了

以上是关于CF1207A There Are Two Types Of Burgers的主要内容,如果未能解决你的问题,请参考以下文章