DMOPC '15 Contest 6 P1 - Double XP Weekend

View as PDF

Submit solution

Points: 5
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Xyene is preparing for the MMORPG ScapeRune's Double XP Weekend. In ScapeRune, there are many skills, with each player having a certain integer amount of experience in it. Xyene currently has E_i experience in the Uncooking skill (a skill dedicated to the uncooking of cooked fish), and he would like to get E_f experience in Uncooking. In order to do so, he will need to uncook fish, with the uncooking of each fish awarding him experience. Uncooking each fish costs C coins each, and gives B base experience.

A player may also possess bonus experience in a skill. Bonus experience is converted into actual experience every time a player gains experience, with amount of bonus experience used up equal to the base experience earned. Xyene currently has E_b bonus experience in the uncooking skill.

On Double XP Weekend, Xyene earns an additional amount of extra experience equal to the base experience of any actions he performed. In other words, if he uncooks some fish, he would earn an extra B experience. This effect does not stack with bonus experience on Double XP Weekend: assuming he has enough bonus experience, Xyene earns 3B experience every time he uncooks fish, consuming B bonus experience.

Xyene would like to know how much fish he must uncook and how much money he would need to spend in order to achieve his goal of E_f experience.

Input Specification

The input consists of the following integers, each on its own line, in order:

  • E_i: Xyene's current experience in Uncooking (0 \le E_i \le 200\,000\,000).
  • E_f: Xyene's desired experience in Uncooking (0 \le E_f \le 200\,000\,000; E_f \ge E_i).
  • E_b: Xyene's current bonus experience in Uncooking (0 \le E_b \le 200\,000\,000).
  • B: the experience gained by the type of fish Xyene is Uncooking (1 \le B \le 10\,000).
  • C: the cost per fish (0 \le C \le 100\,000).

Output Specification

The output consists of two lines, the first containing the number of fish Xyene needs to uncook, and the second the amount of coins doing so would cost him.

Sample Input

1798808
9684577
1048576
325
4428

Sample Output

10519
46578132

Explanation

Xyene currently has 1\,798\,808 experience in Uncooking and he wants to get to 9\,684\,577 experience. He has 1\,048\,576 bonus experience. In order to do so, he will be uncooking food that gives 325 experience per item, with each food item costs 4\,428 to uncook.

  • For the first 3\,226 fish Xyene uncooks, he earns 325 base experience, 325 extra experience from Bonus XP Weekend, and 325 bonus experience is converted to real experience, for a total of 975 experience per fish. This will earn him 3\,145\,350 experience, in total.
  • For the 3\,227^{th} fish, he would only convert 126 bonus experience, as he has no more left. This makes him earn 776 experience for it.
  • If he uncooks 7\,292 more fish, he would be able to get 4\,739\,800 more experience (at the rate of 650 per fish, since he is out of bonus experience).

After finishing his supply of fish, his final experience would be 1\,798\,808 + 3\,145\,350 + 776 + 4\,739\,800 = 9\,684\,734, which is 157 experience above his goal. He could not uncook less fish and still reach his goal.

Therefore, Xyene must uncook 10\,519 fish, at a cost of 4\,428 \times 10\,519 = 46\,578\,132 coins.


Comments


  • -1
    fsagrdjfsdbjfgvsvhb  commented on Nov. 11, 2023, 12:36 a.m.

    I is not understand this problem


  • 4
    aCookieBreak  commented on March 5, 2016, 9:25 p.m. edited

    Why do I understand everything about the question, including the rules of double XP, the 200 million xp constraint, the uncooking skill, and the name of the MMORPG? I feel like I have no life. -_-


    • 2
      Kirito  commented on March 6, 2016, 4:29 a.m.

      Maybe you do...

      PS NXT Client FTW.


    • 6
      Xyene  commented on March 5, 2016, 11:42 p.m.

      This problem is way too real.


      • 6
        FatalEagle  commented on March 5, 2016, 11:47 p.m.

        GZ ON 99 SUMMONING o wait


  • 2
    bobhob314  commented on March 2, 2016, 12:29 a.m.

    For C and B, the constraints refer to E_i. >_<