cswork / OA打开练习工作台

IBMOA #35

Get Minimum Cost

估计简单可在线判题

考点(AI 标注)位运算贪心调度

A and B can be bought individually, or as a bundle containing one A and one B. You need at least x of A and y of B and may buy more than needed; find the minimum cost.

输入格式

One line containing costA costB costAB x y, each an integer in 1..10^9.

输出格式

Output one integer, the answer.

样例 1

输入:

3 4 2 2 1

输出:

4

样例 2

输入:

3 4 10 2 1

输出:

10

样例 3

输入:

9 9 1 1 3

输出:

3

样例说明

The examples give 4, 10 and 3 respectively; the first and third examples rely on buying extra equipment.