#t358. 美元汇率
美元汇率
Dollar Exchange Rate
Problem Background
(This problem omits the MAX_INT+1 numbers.)
Problem Description
Over the next several days, David will study the exchange rate between the US dollar and the German mark. Write a program to help David decide when to buy or sell marks or dollars, so that starting from $100 he can end up with the highest possible value.
Input Format
The first line of the input file is a natural number , the number of days David studies the exchange rate.
The following lines each contain a natural number . The in line is the average exchange rate for day , on which David can either use dollars to buy marks, or use marks to buy dollars.
Output Format
The first and only line of the output file should contain the required amount of money (in dollars, kept to two decimal places).
Note: because of rounding errors in floating-point arithmetic, an answer within dollars of the correct result is considered correct. David must convert all his money back into dollars before the end of the last day.
Sample Input
5
400
300
500
300
250
Sample Output
266.67
Sample Explanation
Day 1 ... changing 100.0000 dollars = 400.0000 marks
Day 2 ... changing 400.0000 marks = 133.3333 dollars
Day 3 ... changing 133.3333 dollars = 666.6666 marks
Day 5 ... changing 666.6666 marks = 266.6666 dollars
Update on 2017/08/18:
- The correct answer for the sample is .
- Test point has been changed to the sample.
- The original SPJ tolerance was ; according to the problem statement it has been changed back to .