代码

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

溜了溜了