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

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


Sample Output


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.


  • 0
    Heini  commented on Sept. 4, 2021, 10:27 a.m. edited

    Took me several minutes to understand the problem. Maybe my English is not good enough or I´m just dumb.

    Edit: Why downvote my comment? Because I was honest?

  • -2
    jadam89  commented on Aug. 27, 2021, 5:54 p.m. edited

    I noticed this word problem wants us to determine how much paint James will like to use per badge. Using the sample input from above, we can see that if James has 14 litres of paint, and wants to use 3 liters per badge, and charge 10 dollars per badge, that he can make 42 dollars.(Do not forget about the remaining paint) So now we can imagine an equation or two to determine different situations where James might want to use less paint, or charge more money. We design a code to help James mathematically determine how he wants to proceed with his small business.

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

    This problem doesn't make logical sense.

    • 4
      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.