Question: C Programming Language Problem Title: Mountain Climber Mountain summit is an interesting destination for mountain climbers. The Seven Summits is a term to describe seven
C Programming Language
Problem Title: Mountain Climber
Mountain summit is an interesting destination for mountain climbers. The Seven Summits is a term
to describe seven mountains peak which cover all the seven tectonic plate in the world.
Jojo as an amateur climber wants to conquer a mountain range , which still easy to climb, to prepare
himself to conquer The Seven Summits. Jojo and his friends have a list of N spot on a mountain range.
(There is a professional mountain climber group that divide the mountain range into N strategic points)
If someone want to climb this mountain range, it always starts at the first point. We can say Climb Up
if we go from lower altitude point to the higher ones and Climb Down otherwise.
Jojo and his friends want you to find how long is the range to get exactly K Climb Up and M Climb Down?
Note that this range could be start from any point.
Format Input
Input consists of one integer T, the number of test case. For each test case, it contains 3 integers N, K, M - number of points on the mountain range, number of Climb Up, and number of Climb Down for this expedition. The next line contains N integers Ai - the altitude for every point on the mountain range.
Format Output
Output should be expressed in format Case #X: Y - X is the number of test case,
and followed by Y - minimum length of the range such fulfill the criterion above.
If there is no solution exist, output -1 as the answer.
Constraints
1 T 50 1 N 100000 0 K, M N 100 Ai 3000
Sample Input & Output (standard input & output)
3
4 1 0
1296 1331 2144 2856
Case #1: 2
6 2 2
1777 1002 2914 1998 1525 2213
Case #2: 5
5 3 0
1000 1001 1002 1003 1004
Case #3: 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
