|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|0.3 초||4 MB||80||24||16||43.243%|
Jim is fond of Pokemons, and plays all kinds of games involving them. Now, he plays a trading game. He knows the price of a Pokemon on each day over the next n days (Pokemons have the same price, no matter the type). He starts with a given amount of money, and picks one day to buy as many Pokemons (including fractions of them) as he can afford - he must spend all his money, and then sell them all on some subsequent day. Obviously, he wants to maximize his profit (or minimize the losses), and must decide very fast. Can you help him?
The input file starts with the amount of money Jim will use. The next line contains the number n (1 < n ≤ 106 ) of days. Starting from a different line follows the n space-separated prices of Pokemons for each day.
The output file contains the maximum profit (may be negative also), a real number with 2 decimal digits (0.005 is 0.01 while 0.0049 is 0.00; -0.005 is -0.01 and -0.0049 is -0.00).
100.7 5 1 2.88 3.05 4.33 5.5
The sample describes an instance of the game. The first line of the input contains the amount of money, the next one the number of days, the following line contains the prices per day of the Pokemons.