Question: Problem A: Climbing Worm An inch worm is at the bottom of a well n inches deep. It has enough energy to climb u inches
Problem A:
Climbing Worm An inch worm is at the bottom of a well n inches deep. It has enough energy to climb u inches every minute, but then has to rest a minute before climbing again. During the rest, it slips down d inches. The process of climbing and resting then repeats. How long before the worm climbs out of the well?
Well always count a portion of a minute as a whole minute and if the worm just reaches the top of the well at the end of its climbing, well assume the worm makes it out.
Input
There will be multiple problem instances. Each line will contain 3 positive integers n, u and d. These give the values mentioned in the paragraph above. Furthermore, you may assume d < u and n < 100. A value of n = 0 indicates end of output.
Output
Each input instance should generate a single integer on a line, indicating the number of minutes it takes for the worm to climb out of the well.
Sample Input
10 2 1
20 3 1
0 0 0
Sample Output
17
19
Question 5: Refer to Problem A provided above and consider the following Judges secret data set below used to test the solutions submitted by the teams in an ICPC competition:
10 2 1
20 3 1
99 5 2
50 7 2
20 13 4
15 6 3
7 4 1
9 9 3
0 0 0
a. Clearly outline a reasonable overall strategy that would lead to uncovering the highest number of errors for any submitted solution for the assigned problem.
b. Evaluate the judges secret data set. Not withstanding the fact that an exhaustive set of input cases is not possible, classify each input in terms of the strategy that you think the judge used to come up with each particular test case. Did the judge miss any major test strategy that would have had key test cases? What test case(s) would you add, if at all, and why (justify your strategy if you would modify this judge data set.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
