CF1271A.Suits

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

A new delivery of clothing has arrived today to the clothing store. This delivery consists of aa ties, bb scarves, cc vests and dd jackets.

The store does not sell single clothing items — instead, it sells suits of two types:

  • a suit of the first type consists of one tie and one jacket;
  • a suit of the second type consists of one scarf, one vest and one jacket.

Each suit of the first type costs ee coins, and each suit of the second type costs ff coins.

Calculate the maximum possible cost of a set of suits that can be composed from the delivered clothing items. Note that one item cannot be used in more than one suit (though some items may be left unused).

今天,一家服装店收到了一批新到的服装。这批服装包括 aa 条领带、bb 条围巾、cc 件马甲和 dd 件夹克。

该商店不单独销售服装单品,而是销售两种类型的套装:

  • 第一种套装由一条领带和一件夹克组成;
  • 第二种套装由一条围巾、一件马甲和一件夹克组成。

每套第一种套装售价为 ee 枚金币,每套第二种套装售价为 ff 枚金币。

请计算:利用这批到货的服装所能组成的套装集合的最大可能总售价。注意,每件服装只能用于一套套装中(但部分服装可以不使用)。

输入格式

The first line contains one integer aa (1≤a≤100 000)(1 \le a \le 100\,000) — the number of ties.

The second line contains one integer bb (1≤b≤100 000)(1 \le b \le 100\,000) — the number of scarves.

The third line contains one integer cc (1≤c≤100 000)(1 \le c \le 100\,000) — the number of vests.

The fourth line contains one integer dd (1≤d≤100 000)(1 \le d \le 100\,000) — the number of jackets.

The fifth line contains one integer ee (1≤e≤1 000)(1 \le e \le 1\,000) — the cost of one suit of the first type.

The sixth line contains one integer ff (1≤f≤1 000)(1 \le f \le 1\,000) — the cost of one suit of the second type.

第一行包含一个整数 aa(1≤a≤100 0001 \le a \le 100\,000)—— 领带的数量。
第二行包含一个整数 bb(1≤b≤100 0001 \le b \le 100\,000)—— 围巾的数量。
第三行包含一个整数 cc(1≤c≤100 0001 \le c \le 100\,000)—— 背心的数量。
第四行包含一个整数 dd(1≤d≤100 0001 \le d \le 100\,000)—— 夹克的数量。
第五行包含一个整数 ee(1≤e≤1 0001 \le e \le 1\,000)—— 第一种套装的单价。
第六行包含一个整数 ff(1≤f≤1 0001 \le f \le 1\,000)—— 第二种套装的单价。

输出格式

Print one integer — the maximum total cost of some set of suits that can be composed from the delivered items.

输出一个整数——从所交付的物品中能够组成的若干套西装的最高总成本。

输入输出样例

  • 输入#1

    4
    5
    6
    3
    1
    2

    输出#1

    6
  • 输入#2

    12
    11
    13
    20
    4
    6

    输出#2

    102
  • 输入#3

    17
    14
    5
    21
    15
    17

    输出#3

    325

说明/提示

It is possible to compose three suits of the second type in the first example, and their total cost will be 66. Since all jackets will be used, it's impossible to add anything to this set.

The best course of action in the second example is to compose nine suits of the first type and eleven suits of the second type. The total cost is 9⋅4+11⋅6=1029 \cdot 4 + 11 \cdot 6 = 102.

在第一个例子中,可以组成三套第二种类型的套装,其总成本为 66。由于所有夹克都将被使用,因此无法向该组合中添加任何其他套装。

在第二个例子中,最佳方案是组成九套第一种类型的套装和十一套第二种类型的套装。总成本为 9⋅4+11⋅6=1029 \cdot 4 + 11 \cdot 6 = 102。

输入解题思路,AI测评打分。不知道怎么写?

首页