CF1150A.Stock Arbitraging

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

Welcome to Codeforces Stock Exchange! We're pretty limited now as we currently allow trading on one stock, Codeforces Ltd. We hope you'll still be able to make profit from the market!

In the morning, there are nn opportunities to buy shares. The ii-th of them allows to buy as many shares as you want, each at the price of sis_i bourles.

In the evening, there are mm opportunities to sell shares. The ii-th of them allows to sell as many shares as you want, each at the price of bib_i bourles. You can't sell more shares than you have.

It's morning now and you possess rr bourles and no shares.

What is the maximum number of bourles you can hold after the evening?

欢迎来到 Codeforces 股票交易所!目前我们的业务范围较为有限,仅支持交易一只股票:Codeforces 公司股票。但我们相信您依然能从中获利!

早晨共有 nn 次购股机会。第 ii 次机会允许您以每股 sis_i 博尔(bourles)的价格购买任意数量的股票。

傍晚共有 mm 次售股机会。第 ii 次机会允许您以每股 bib_i 博尔(bourles)的价格出售任意数量的股票。但您出售的股票数量不能超过您当前持有的数量。

现在是早晨,您手头有 rr 博尔(bourles),且尚未持有任何股票。

请问:经过傍晚交易后,您最多能持有多少博尔(bourles)?

输入格式

The first line of the input contains three integers n,m,rn, m, r (1≤n≤301 \leq n \leq 30, 1≤m≤301 \leq m \leq 30, 1≤r≤10001 \leq r \leq 1000) — the number of ways to buy the shares on the market, the number of ways to sell the shares on the market, and the number of bourles you hold now.

The next line contains nn integers s1,s2,…,sns_1, s_2, \dots, s_n (1≤si≤10001 \leq s_i \leq 1000); sis_i indicates the opportunity to buy shares at the price of sis_i bourles.

The following line contains mm integers b1,b2,…,bmb_1, b_2, \dots, b_m (1≤bi≤10001 \leq b_i \leq 1000); bib_i indicates the opportunity to sell shares at the price of bib_i bourles.

输入的第一行包含三个整数 n,m,rn, m, r(1≤n≤301 \leq n \leq 30,1≤m≤301 \leq m \leq 30,1≤r≤10001 \leq r \leq 1000)——分别表示在市场中购买股票的方式数量、出售股票的方式数量,以及你当前持有的布尔列(bourles)数量。

接下来的一行包含 nn 个整数 s1,s2,…,sns_1, s_2, \dots, s_n(1≤si≤10001 \leq s_i \leq 1000);其中 sis_i 表示以 sis_i 布尔列的价格购买股票的机会。

再下一行包含 mm 个整数 b1,b2,…,bmb_1, b_2, \dots, b_m(1≤bi≤10001 \leq b_i \leq 1000);其中 bib_i 表示以 bib_i 布尔列的价格出售股票的机会。

输出格式

Output a single integer — the maximum number of bourles you can hold after the evening.

输出一个整数——晚上结束后你最多能持有的布尔币数量。

输入输出样例

  • 输入#1

    3 4 11
    4 2 5
    4 4 5 4

    输出#1

    26
  • 输入#2

    2 2 50
    5 7
    4 2

    输出#2

    50

说明/提示

In the first example test, you have 1111 bourles in the morning. It's optimal to buy 55 shares of a stock at the price of 22 bourles in the morning, and then to sell all of them at the price of 55 bourles in the evening. It's easy to verify that you'll have 2626 bourles after the evening.

In the second example test, it's optimal not to take any action.

在第一个样例测试中,你早上有 1111 博尔勒斯。最优策略是在早上以每股 22 博尔勒斯的价格买入 55 股股票,然后在晚上以每股 55 博尔勒斯的价格全部卖出。容易验证,晚上结束后你将拥有 2626 博尔勒斯。

在第二个样例测试中,最优策略是不进行任何操作。

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

首页