Find solutions to your problems with the expert advice available on IDNLearn.com. Find the solutions you need quickly and accurately with help from our knowledgeable community.
2. Jump To The Flag Bob is trying to reach a flag that's some height above the ground. In his attempt to reach the flag, Bob can make any number of jumps up the rock wall where it's mounted. He can only move up the wall though, and he must end at exactly the height of the flag. There are 2 types of jumps: 1. A jump of height 1. 2. A jump of height; Determine the minimum number of jumps it will take Bob to reach the flag's height exactly For example, the flag is at height k=8 and jump height j=3. Bob starts at height 0, takes two jumps of height j and two of height 1 to reach exactly 8 units in 4 jumps. Due to his movement restriction, he could not jump 3 x j to 9 units and climb down. Function Description Complete the function jumps in the editor below. The function must return an integer denoting the minimum number jumps has the following parameter(s): k: an integer, the flag height j: an integer, the height of the second type of jump Constraints 2 • 1 sjik s 10 Input Format for Custom Testing Input from stdin will be processed as follows and passed to the function. The first line contains an integer k. The second line contains an integer j. Sample Case o Sample Input o Sample Output 0 1 > #include ... * * Complete the 'jumps' function below. * * * The function is expected to return an INTEGER. The function accepts following parameters: 1. INTEGER k 2. INTEGER ; * * * int jumps (int k, int 23 > int main() ...
Sagot :
We are delighted to have you as part of our community. Keep asking, answering, and sharing your insights. Together, we can create a valuable knowledge resource. Thank you for choosing IDNLearn.com. We’re dedicated to providing clear answers, so visit us again for more solutions.