시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 21 | 12 | 11 | 68.750% |
Dave somehow acquired exchange rates of US dollar to German marks for several days in the future. Write a program that will suggest Dave when to buy or sell marks or dollars so that, starting with 100 marks he ends up with the highest possible amount of marks at the end of the last day.
The first line of input file contains a natural number N, 1 ≤ N ≤ 100, the number of future days for which Dave knows exchange rates.
Each of N following lines contains two natural numbers B and S separated with a space, 100 ≤ B ≤ S ≤ 1000. The (i+1)th line describes the exchange rate of ith day in advance.
Those two numbers determine the exchange rate in the following way: B dollars can be bought for 100 marks, and 100 marks can be bought for S dollars.
The first and only line of output file should contain a desired amount written to two decimal places.
Remark: Due to real arithmetic round off errors, results within error of 0.05 marks of correct value will be regarded as correct.
3 393 398 394 401 386 386
102.07
5 300 300 310 320 320 330 330 330 300 320
103.12
8 218 219 228 231 227 235 205 213 230 232 239 239 251 258 205 213
126.14