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 Ei experience in the Uncooking skill (a skill dedicated to the uncooking of cooked fish), and he would like to get Ef 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 Eb 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 Ef experience.

Input Specification

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

  • Ei: Xyene's current experience in Uncooking (0Ei200000000).
  • Ef: Xyene's desired experience in Uncooking (0Ef200000000;EfEi).
  • Eb: Xyene's current bonus experience in Uncooking (0Eb200000000).
  • B: the experience gained by the type of fish Xyene is Uncooking (1B10000).
  • C: the cost per fish (0C100000).

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

Copy
1798808
9684577
1048576
325
4428

Sample Output

Copy
10519
46578132

Explanation

Xyene currently has 1798808 experience in Uncooking and he wants to get to 9684577 experience. He has 1048576 bonus experience. In order to do so, he will be uncooking food that gives 325 experience per item, with each food item costs 4428 to uncook.

  • For the first 3226 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 3145350 experience, in total.
  • For the 3227th 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 7292 more fish, he would be able to get 4739800 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 1798808+3145350+776+4739800=9684734, which is 157 experience above his goal. He could not uncook less fish and still reach his goal.

Therefore, Xyene must uncook 10519 fish, at a cost of 4428×10519=46578132 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 Ei. >_<