Codeforces 1342 A. Road To Zero_8

题意:

给定非负整数 Codeforces 1342 A. Road To Zero_8_02 ,两个操作 Codeforces 1342 A. Road To Zero_8_03 (花费 Codeforces 1342 A. Road To Zero_8_04 ),操作 Codeforces 1342 A. Road To Zero_8_05 (花费 Codeforces 1342 A. Road To Zero_8_06):求让 Codeforces 1342 A. Road To Zero_8_07 的最少花费是多少。
只需要讨论 Codeforces 1342 A. Road To Zero_8_08Codeforces 1342 A. Road To Zero_8_06

AC代码:

ll x, y, a, b;
ll ans, res;
int main()
{
int t;
sd(t);
while (t--)
{
sldd(x, y);
sldd(a, b);
ll z = min(x, y);
ans = z * min(a * 2, b);
x -= z;
y -= z;
ans += x * a;
ans += y * a;
pld(ans);
}
return 0;
}