Answered step by step
Verified Expert Solution
Link Copied!

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.
1 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 2 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 3 higher bridge to a lower bridge.
Diego needs k points to move to the next level in the 4 game. He is trying to figure out if can he make Mario jump in such a way that he can earn at least k points, and if so, how many such different ways are 5 there. Can you write a program to help Diego?
Complete the function computePossibilities which 6 accepts four arguments as below, and returns the number of ways to succeed in the game:
The input parameters are:
A long Integer k which indicates the minimum number of points Diego needs
An Integer N 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 k which indicates the minimum number of points Diego needs
An Integer N which indicates the number of floating bridges
An array of integers heights which indicates the heights of N floating bridges
An array of integers points which indicates the points of N floating bridges
Constraints:
1N40, the number of floating bridges 1k108, the minimum points Diego needs 1Hi,Pi109, the heights and points of the it bridge
Input Format:
The first line of input contains k, the minimum points.
The second line of input contains N, the number of floating bridges
Next N lines of input contain the heights (Hl) of N bridges
Next line of input again contains N, the number of floating bridges
Next N lines of input contain the points (P) of N

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Provide the correct IUPAC name for the compound shown here

Answered: 1 week ago