P1968 USD Exchange Rate
Background
此处省略 `MAX_INT+1` 个数。
Description
In the coming days, David will study the exchange rate between the US dollar and the Deutsche Mark. Write a program to help David decide when he should buy or sell marks or dollars so that, starting from $100$ dollars, he can end up with the highest possible value.
Input Format
The first line of the input file contains a natural number $N$, $1 \le N \le 100$, which is the number of days David studies the exchange rate.
Each of the next $N$ lines contains a natural number $A$, $1 \le A \le 1000$. The $A$ on line $i+1$ gives the known average exchange rate for day $i+1$: on that day, David can use $100$ dollars to buy $A$ marks, and he can also use $A$ marks to buy $100$ dollars.
Output Format
Output a single line with the required amount of money (in dollars), rounded to two decimal places.
Note: Considering rounding errors in real-number arithmetic, any result within $0.05$ dollars of the correct answer is accepted. David must convert all his money back to dollars before the end of the last day.
Explanation/Hint
**Sample explanation**
```cpp
Day 1 ... changing 100.0000 USD= 400.0000 Mark
Day 2 ... changing 400.0000 Mark= 133.3333 USD
Day 3 ... changing 133.3333 USD= 666.6666 Mark
Day 5 ... changing 666.6666 Mark= 266.6666 USD
```
Updated on 2017/08/18:
1. The correct answer to the sample is $266.67$.
2. Test point $1$ has been replaced by the sample.
3. The SPJ's tolerance used to be $0.01$; according to the statement, it has been changed to $0.05$.
Translated by ChatGPT 5