今天没什么想说的 emmmmm
直接上题吧
Exchange Rates
Now that the Loonie is hovering about par with the Greenback, you have decided to use your $1000 entrance scholarship to engage in currency speculation. So you gaze into a crystal ball which predicts the closing exchange rate between Canadian and U.S. dollars for each of the next several days. On any given day, you can switch all of your money from Canadian to U.S. dollars, or vice versa, at the prevailing exchange rate, less a 3% commission, less any fraction of a cent.
Assuming your crystal ball is correct, what's the maximum amount of money you can have, in Canadian dollars, when you're done?
输入:
The input contains a number of test cases, followed by a line containing 0. Each test case begins with 0 <d ≤ 365, the number of days that your crystal ball can predict. d lines follow, giving the price of a U.S. dollar in Canadian dollars, as a real number.
输出:
For each test case, output a line giving the maximum amount of money, in Canadian dollars and cents, that it is possible to have at the end of the last prediction, assuming you may exchange money on any subset of the predicted days, in order.
翻译:
汇率
现在,洛尼与Greenback持平,你决定用1000美元的入学奖学金从事货币投机。因此,你凝视着一个水晶球,它预测未来几天加拿大和美元之间的收盘汇率。在任何一天,你都可以按照现行汇率,减去3%的佣金,再减去0.5美分,将你所有的钱从加拿大换成美元,反之亦然。
假设你的水晶球是正确的,当你完成后,你能拥有的最高金额是多少(以加元计)?
输入:
输入包含多个测试用例,后跟一行0。每个测试用例从0<d开始≤ 365,你的水晶球可以预测的天数。随后是d行,给出了以加元表示的美元价格,作为实数。
输出:
对于每个测试用例,输出一行,给出在上一次预测结束时可能拥有的最大金额,以加元和美分为单位,假设您可以按顺序在预测日期的任何子集上兑换货币。
动态规划的题有点多 害