CF41B.Martian Dollar

普及/提高-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

One day Vasya got hold of information on the Martian dollar course in bourles for the next n days. The buying prices and the selling prices for one dollar on day i are the same and are equal to a__i. Vasya has b bourles. He can buy a certain number of dollars and then sell it no more than once in n days. According to Martian laws, one can buy only an integer number of dollars. Which maximal sum of money in bourles can Vasya get by the end of day n?

一天,瓦西娅获得了未来 nn 天内火星美元兑布尔勒斯(bourles)的汇率信息。第 ii 天买入与卖出 1 美元的价格相同,均为 aia_i。瓦西娅当前拥有 bb 布尔勒斯。他可以买入一定数量的美元,并且在 nn 天内最多只能卖出一次。根据火星法律,美元只能以整数单位购买。问:到第 nn 天结束时,瓦西娅最多能拥有多少布尔勒斯?

输入格式

The first line contains two integers n and b (1 ≤ n, b ≤ 2000) — the number of days and the initial number of money in bourles. The next line contains n integers a__i (1 ≤ a__i ≤ 2000) — the prices of Martian dollars.

第一行包含两个整数 nn 和 bb(1≤n,b≤20001 \leq n, b \leq 2000)——分别表示天数和初始的布尔币金额。
下一行包含 nn 个整数 aia_i(1≤ai≤20001 \leq a_i \leq 2000)——表示火星美元的价格。

输出格式

Print the single number — which maximal sum of money in bourles can Vasya get by the end of day n.

输出唯一的数字——即瓦西娅在第 nn 天结束时所能获得的最大金额(单位:布尔列)。

输入输出样例

  • 输入#1

    2 4
    3 7

    输出#1

    8
  • 输入#2

    4 10
    4 3 2 1

    输出#2

    10
  • 输入#3

    4 10
    4 2 3 1

    输出#3

    15

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

首页