Logo
(追記) (追記ここまで)

13861번 - Pokemons 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
0.3 초 4 MB183573227.586%

문제

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).

제한

예제 입력 1

100.7
5
1 2.88 3.05 4.33 5.5

예제 출력 1

453.15

힌트

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.

출처

ICPC > Regionals > Europe > Southeastern European Regional Contest > SEERC 2016 G번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /