Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Event Timing

By Shafaet07 · Limits 2s, 512 MB

Bob is making a new application for Android phones. Front-end of his app has a button like this:

When he press the button, a process starts in the back-end. The process needs k seconds to complete. During this k seconds the button looks like this:

To check if a process is completed, Bob wrote a special checker which always runs in the background. The checker checks the progress in every d seconds starting from the moment someone pressed the button. If it sees that the process is completed, it changes the text of the button.

Suppose the user pressed the button in the pth second. Given the value of p (1<=p<=100), k (1<=k<=1000) and d (1<=d<=1000), can you find when the button will display “Done!” ?


First line will consist T(1<=T<=1000), denoting number of testcases. For each testcase, there are 3 space separated integers, p, k and d.


For each case, print the case number and the answer.


10 14 8
Case 1: 26



82% Solution Ratio

oneoff.n7l6YL8uo2Earliest, Oct '16

oneoff.gEhBO3mEkeFastest, 0.0s

fahad_69Lightest, 0 B

touhidurShortest, 99B


Login to submit