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 ;
}

溜了溜了

原文地址:https://www.cnblogs.com/lyt020321/p/11401977.html