2021-07-22 AcWing 3776. 水果拼盘
输入样例:
3 4 5 6 3 1 2 12 11 13 20 4 6 17 14 5 21 15 17
输出样例:
6 102 325
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
int T;
cin >> T;
while (T -- )
{
int a, b, c, d, e, f;
int min1,min2;
scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
if (e > f){
min1 = min(a, d);
min2 = min({b, c, d - min1});
}else{
min2 = min({b, c, d});
min1 = min(a, d - min2);
}
cout << e*min1+f*min2 << endl;
}
return 0;
}
本文来自博客园,作者:泥烟,CSDN同名, 转载请注明原文链接:https://www.cnblogs.com/Knight02/p/15799156.html