A. Suits
 

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).

Input

The first line contains one integer aa (1≤a≤100000) — the number of ties.

The second line contains one integer bb (1≤b≤100000) — the number of scarves.

The third line contains one integer cc (1≤c≤100000) — the number of vests.

The fourth line contains one integer dd (1≤d≤100000) — the number of jackets.

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

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

Output

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

Examples
Input

Copy
4
5
6
3
1
2
Output

Copy
6
Input

Copy
12
11
13
20
4
6
Output

Copy
102
Input

Copy
17
14
5
21
15
17
Output

Copy
325
Note

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=102.

题目大意:在一个服装店中有领带a个,围巾b个,背心c个,夹克d个。

现在有两种搭配:

1.a+d   e元

2.b+c+d f元

最佳搭配方案使得钱数最大

思路:比较e,f分类讨论

AC代码:

#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
inline int read() {int x=,f=;char c=getchar();while(c!='-'&&(c<''||c>''))c=getchar();if(c=='-')f=-,c=getchar();while(c>=''&&c<='')x=x*+c-'',c=getchar();return f*x;}
typedef long long ll;
const int maxn = 1e6+;
int main()
{
ll a,b,c,d,e,f;
cin>>a>>b>>c>>d>>e>>f;
if(e>=f){
if(a>=d){
printf("%lld\n",e*d);
}
else{
ll sum=e*a;
d-=a;
ll t=min(b,min(c,d));
sum+=f*t;
printf("%lld",sum);
}
}
else{
ll t=min(b,min(c,d));//求三数最小值
ll sum=t*f;
d-=t;
if(d>){
int y=min(a,d);
sum+=e*y;
}
printf("%lld",sum);
}
return ;
}

codeforces-1271A - Suits的更多相关文章

  1. [Codeforces #608 div2]1271A Suits

    Description A new delivery of clothing has arrived today to the clothing store. This delivery consis ...

  2. Codeforces Round #608 (Div. 2) 题解

    目录 Codeforces Round #608 (Div. 2) 题解 前言 A. Suits 题意 做法 程序 B. Blocks 题意 做法 程序 C. Shawarma Tent 题意 做法 ...

  3. 【codeforces 760C】Pavel and barbecue

    time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  4. 【cf补题记录】Codeforces Round #608 (Div. 2)

    比赛传送门 再次改下写博客的格式,以锻炼自己码字能力 A. Suits 题意:有四种材料,第一套西装需要 \(a\).\(d\) 各一件,卖 \(e\) 块:第二套西装需要 \(b\).\(c\).\ ...

  5. python爬虫学习(5) —— 扒一下codeforces题面

    上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...

  6. 【Codeforces 738D】Sea Battle(贪心)

    http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...

  7. 【Codeforces 738C】Road to Cinema

    http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...

  8. 【Codeforces 738A】Interview with Oleg

    http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...

  9. CodeForces - 662A Gambling Nim

    http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...

  10. CodeForces - 274B Zero Tree

    http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...

随机推荐

  1. Javaweb项目不需要端口号及项目名的访问配置(已备注)

    1.不需要端口号的配置: 在server.xml中找到节点: <Connector URIEncoding="UTF-8" connectionTimeout="2 ...

  2. Codeforces Round #613 (Div. 2) A-E简要题解

    contest链接:https://codeforces.com/contest/1285 A. Mezo Playing Zoma 签到 #include<iostream> #incl ...

  3. Python入门3 —— 基本数据类型

    一:为何变量值(记录的数据)要有类型呢? 1.既然可以记录事物的状态,为什么要分类型呢? 变量值是来记录事物状态的, 而事物的状态是多种多样的, 所以对应着就要应该用不同类型的值去记录这些状态. 二: ...

  4. oracle查询第几行到第几行的数据

    我想查询10条到20条的数据 注意: 1.大数在前,小数在后面 2.都是小于 () minus (); 运行结果:

  5. 磁盘分区(1):fdisk和parted

    一.Linux存储管理 关于Linux硬盘的识别: (1)如果是IDE设备,在计算机中将被识别为hd,第一个IDE设备会被识别为hda,第二个IDE设备会被识别为hdb,依此类推. (2)如果是SAT ...

  6. 解决Macbook Pro蓝牙不可用问题

    谷歌搜索了下,在威锋网看到一个帖子,需要关机重置电源管理单元和系统NVRAM恢复出厂设置,具体操作如下:1.关机2.同时按下shift+control+option+power,保持5秒左右3.先按下 ...

  7. Spark On Yarn搭建及各运行模式说明

    之前记录Yarn:Hadoop2.0之YARN组件,这次使用Docker搭建Spark On  Yarn 一.各运行模式 1.单机模式 该模式被称为Local[N]模式,是用单机的多个线程来模拟Spa ...

  8. 解决async 运行多线程时报错RuntimeError: There is no current event loop in thread 'Thread-2'

    原来使用: loop = asyncio.get_event_loop()task = asyncio.ensure_future(do_work(checker))loop.run_until_co ...

  9. webpack4.x基本配置

    在学习vue的时候,需要进行打包操作,视频看的是webpack3的踩了好多坑,所以在记录一下,方便后续复习.有错误请指出. 新建项目文件 在项目文件下 执行npm init -y,进行初始化,生成pa ...

  10. vue使用axios访问后台接口

    链接1:https://segmentfault.com/a/1190000012635783#item-2    // axios 使用post方式传递参数,后端接受不到,怎么解决 链接2:http ...