WC '18 Contest 3 J1 - An Honest Day's Work

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 1.0s
Memory limit: 16M

Author:
Problem types
Woburn Challenge 2018-19 Round 3 - Junior Division

Jessie, James, and Meowth, members of the honourable Team Rocket, have unfortunately fallen on hard times. With their funds necessarily allocated to constructing all manner of giant robots and other devices, they've been having difficulty affording any food lately. But that's nothing that an honest day's work can't fix!

James has a can of leftover paint, containing P (1 \le P \le 100) litres of the stuff. When combined with his boundless collection of bottlecaps, this can result in some high-quality wares. When a bottlecap is artfully covered with B (1 \le B \le 100) litres of paint, it turns into a completely legitimate, Pokémon league-certified gym badge!

James will produce as many badges as he can using the paint, using exactly B litres each. Pokémon trainers love their gym badges, so each such badge is sure to sell for D (1 \le D \le 100) Pokédollars.

There might still be some extra paint left over, once there's not enough for another complete badge. However, there's no need for it to go to waste - James will sell any remaining paint at a rate of 1 Pokédollar per litre.

How much money will James make for Team Rocket in total, from his sales of badges and leftover paint? Hopefully it'll be enough for at least a loaf of bread!

Input Specification

The first line of input consists of a single integer, P.
The second line consists of a single integer, B.
The third line consists of a single integer, D.

Output Specification

Output a single integer, the amount of money which James will make (in Pokédollars).

Sample Input

14
3
10

Sample Output

42

Sample Explanation

James has enough paint for 4 badges, which he'll then sell for 40 Pokédollars. That will leave him with 2 unused litres of paint, which he'll sell for an additional 2 Pokédollars.


Comments


  • -1
    9Deep1Shallow  commented on Sept. 27, 2022, 7:44 a.m.

    try divmod() in Python3


  • -1
    GoldenThumb  commented on July 4, 2022, 8:33 p.m.

    I don't understand why the same 4-line code passes with Python2/3 but got "IR (failed initializing)" for all 7 test cases with PyPy2/3.


  • 2
    Xaalderan  commented on May 25, 2022, 6:28 a.m. edited

    About to go dump 100 litres of paint on 1 single bottle cap


  • 0
    Alexch91  commented on May 23, 2022, 11:36 a.m.

    Can somebody help me? I cannot understand this problem!


  • -1
    terrannz  commented on May 18, 2022, 7:28 p.m.

    That took a lot of commenting in the code to get straight what was actually needing to be done. It was a good thing % and // were fresh in my mind


  • 0
    ilovelearning  commented on April 27, 2022, 2:23 p.m.

    I don't understand how I'm supposed to solve this problem.


  • -1
    Damom73  commented on April 10, 2022, 10:51 p.m.

    rather than using int(), use floor division // instead of division / this will only return integers


  • 1
    asgharianarvin  commented on Dec. 24, 2021, 11:10 p.m. edited

    if you think your solution is correct and you keep getting the right result for test you have developed, try using int() in your for you final answer. I just found out that 42.0 and 42 are different :/


  • 0
    dark_Knight  commented on Dec. 9, 2021, 6:24 a.m.

    I am really stuck with this problem :( not able to find the solution


    • 0
      sushi  commented on Dec. 9, 2021, 10:22 a.m.

      A hint is to look up the modulo operator (%) and how to calculate remainders.


  • 0
    LearnToSolveProblems  commented on Nov. 4, 2021, 5:42 a.m.

    The part which says "With their funds necessarily allocated to constructing all manner of giant robots and other devices, they've been having difficulty affording any food lately." reminds me of the final days in the university when guys 😂 were looking for how to survive due to huge monies spent on final year project. Only those from ATBU can relate


    • 0
      Alchemist46  commented on Nov. 20, 2021, 8:15 a.m.

      hahahahahahaha. I can also relate to my experience during my last year project plus research in university.


  • 3
    random_guy33  commented on Oct. 30, 2021, 10:59 p.m.

    I actually figured it out from the comments.


  • 2
    random_guy33  commented on Oct. 30, 2021, 10:49 p.m.

    I am not a native English speaker and i got no idea what this problem was. now i'm trying to figure it out through the comments.


  • 4
    Omoso  commented on July 12, 2021, 3:26 a.m.

    This problem doesn't make logical sense.


    • 12
      Xiang_li  commented on Sept. 4, 2021, 5:41 p.m.

      James has P liters of paint. Each cap he wants to paint costs B liters of paint. Each painted cap will sell of D dollars. After painting all the caps, the leftover paint will sell for 1 dollar/L.


      • 0
        Omoso  commented on Nov. 7, 2021, 3:41 a.m.

        OK thanks, you have made it more clear.