当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3056:Stock

题目描述
Recently, the Chinese stock market begins to heat up slowly. It is said that in 2009 China's Stock market will re-enter the bull market. Let’s pay some attention to the stock.

Stock is defined as a purely economic issue, it is actually representative of your company's ownership of the shares. But in fact most investors regard it as a kind of commodities, not the production which are made in the factories. Since it is a commodity, there is measurement problem. Fruits are bought by jin, TV sets are bought by set. While the stock is bought in share. Stock and TV set here in set is similar. That is, we can not buy half-shares, and at least buy one share. Of course, stock and fruit, TV set, are different. Stock is so different as the price is changing at all time. Everyone can buy it legally in the trading market. Stock trading costs transaction fees. And the calculation is quite complicated so we don’t dive into this.

To make it easier, we have the problem simplified. First of all, ignore the price changing within a day, meaning that only one constant price on a certain day. Then assuming that only to pay fees when stock are sold, the transaction fee is a fixed value of s.

For example, if the transaction fee is $100. The stock price on the first day is $10 per share. We have $10,000, so we can buy 1,000 shares. The next day, the stock price rise to $11 per share. We sell all the 1,000 shares, so get $11,000. It cost $100 for the fee. So the profit is $900.

In this problem the transaction times is unlimited. You can sell and buy stock time and time again if you like. Now, if we know the stock prices in n trading days, the fee and the initial funding. So, how much money can we earn at most in the n days?
输入解释
There are multiple cases.

The first line contains the number of test cases t.

For each case, the first line contains three integers n (1<n<=3000), s (0<=s<=10000), p (0<p<=100000), respectively, the number of trading days, fee and initial funding. The second line contains n positive real numbers which are greater than 0 (up to two significant figures after the decimal point), the prices are given in chronological order of the n trading days.
输出解释
For each case, output a number, that is this the maximum amount of money you can earn, retained two decimal places. The results are not larger than 10^9.
输入样例
3
4 10 100
10.00 1.00 12.00 10.00
3 10 100
10.5 5.3 1.9
5 10 100
4 1 8 2 5 
输出样例
1090.00
0.00
1865.00 
来自杭电HDUOJ的附加信息
Recommend gaojie

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3056

最后修改于 2020-10-25T22:59:38+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 65535/65535K(Java/Others)