아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Bling

시간 제한2초메모리 제한512 MB

요약
블링, 과일, 성장 단계가 다른 나무를 가진 상태에서 d일(최대 40일) 동안 과일을 팔고 심고 이국 과일을 사서 얻을 수 있는 최대 블링을 구한다.
난이도

보통10점 중 7점

유형
동적 계획법, 완전 탐색, 시뮬레이션, 그리디
정답자
아직 제출이 없습니다

문제

Trapped at home in quarantine, Johan tries to keep madness at bay and fend off isolation by playing Critter Junction, a social simulation video game.  One of the main aspects of the game is collecting and harvesting various types of resources, in order to gain Bling, the currency of the game.  Johan specializes in running the fruit% category of the game, in which the goal is to obtain the maximum amount of Bling in 4040 days using only fruits and no other resources.

Each fruit can be sold for 100100 Bling, or planted to become a fruit tree (but not both).  Every three days, starting on the third day after it was planted, a fruit tree yields three new fruits.

There are also some more exotic fruits that can be bought from the neighboring village.  Once per day, the player can travel to the neighboring village and pay 400400 Bling to buy a single exotic fruit which you can then plant or sell already on the same day.  Analogously to normal fruits, these exotic fruits can be planted into exotic fruit trees which yield three exotic fruits every three days.  Each exotic fruit can be sold for 500500 Bling.

Any number of fruits/exotic fruits can be harvested, sold and planted during a day (subject to availability of course, e.g. it is not possible to sell more fruits than you actually have), but at most a single exotic fruit can be bought.  These activities can be done in any order, so it is for instance possible within the same day to first harvest a few fruits (exotic or not), then sell those fruits for Bling, then use that Bling to buy an exotic fruit, and then either plant or sell that exotic fruit.

Given the current state of Johan's fruit farm, what is the maximum amount of Bling he can achieve in the remaining time?

입력

The input consists of a single line containing six integers dd, bb, ff, t_0t\_0, t_1t\_1 and t_2t\_2 (1≤d≤401 \le d \le 40, 0≤b≤5000 \le b \le 500, and 0≤f,t_0,t_1,t_2≤1000 \le f, t\_0, t\_1, t\_2 \le 100), where:

  • dd is the number of remaining days Johan has
  • bb is the current amount of Bling Johan has.
  • ff is the current number of fruits Johan has.
  • t_it\_i is the number of fruit trees Johan has that will yield crop ii days from today (for 0≤i≤20 \le i \le 2).

Johan currently does not have any exotic fruits or exotic fruit trees.

출력

Output a single integer: the maximum amount of Bling Johan can have after playing dd days.

예제5

  1. 예제 1

    입력
    4 0 1 0 0 0
    
    예상 출력
    300
    
  2. 예제 2

    입력
    5 0 1 0 1 0
    
    예상 출력
    1900
    
  3. 예제 3

    입력
    6 0 1 1 0 0
    
    예상 출력
    2300
    
  4. 예제 4

    입력
    10 399 0 0 0 0
    
    예상 출력
    399
    
  5. 예제 5

    입력
    1 400 0 0 0 0
    
    예상 출력
    500