Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Game Mario Diego is an arcade game enthusiast. His favourite ALL game is Super Mario Bros, in which two Italian plumbers Mario and Luigi try
Game Mario
Diego is an arcade game enthusiast. His favourite ALL game is Super Mario Bros, in which two Italian plumbers Mario and Luigi try to rescue Princess Toadstool from the evil King Bowser in the Mushroom Kingdom.
To reach the Princess, Mario needs to cross a long trench. Luckily for him, the Mushroom kingdom is full of bridges floating in the air, across which Mario can jump and cross the trench. Every bridge he lands on also earns him certain points. The only restriction he has, is that he cannot jump from a higher bridge to a lower bridge.
Diego needs points to move to the next level in the game. He is trying to figure out if can he make Mario jump in such a way that he can earn at least points, and if so how many such different ways are there. Can you write a program to help Diego?
Complete the function computePossibilities which accepts four arguments as below, and returns the number of ways to succeed in the game:
The input parameters are:
A long Integer which indicates the minimum number of points Diego needs
An Integer which indicates the number of floating bridges
An array of integers heightswhich indicates the
Complete the function computePossibilities which accepts four arguments as below, and returns the number of ways to succeed in the game:
The input parameters are:
A long Integer which indicates the minimum number of points Diego needs
An Integer which indicates the number of floating bridges
An array of integers heights which indicates the heights of floating bridges
An array of integers points which indicates the points of floating bridges
Constraints:
the number of floating bridges the minimum points Diego needs the heights and points of the bridge
Input Format:
The first line of input contains the minimum points.
The second line of input contains the number of floating bridges
Next lines of input contain the heights of bridges
Next line of input again contains the number of floating bridges
Next lines of input contain the points of
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started