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

溜了溜了

posted @ 2019-08-23 18:41  _L_Y_T  阅读(192)  评论(0编辑  收藏  举报