A thief Muthhooswamy planned to escape from **** jail. Muthhooswamy is basically a monkey man and he is able to jump across the wall. He practiced to cross a wall and he is able to jump 'X' meters, but because of slippery wall he fall 'Y' meters after each jump. To escape from jail he has to cross 'N' number of walls where height of each wall is given in an array. Write a program to find out the total number of jumps he will make to escape from the jail.
Your program must read 4 arguments (climbUp, climbDown, noOfWalls,wallHeights[]) where
climbUp is the number of metres he can jump (1<=climbUp<=10^10)
climbDown is the number of metres he slides down (1<=climbDown<=10^5)
noOfWalls is the number of walls he needs to jump to escape (1<=noOfWalls<=10^5)
wallHeights[] is a single dimensional array where the height of each wall is provided, the ith element is (1<=i<=1000)
Your program should return total number of jumps to the output variable output1 provided
Sample Input 1: 10:1:1:{10}
Here Muthooswamy can jump 10 metres height but slides down by 1 metre. He has 1 wall to jump and the height of the wall is 10 metres. Since he jumps 10 metres in the first attempt he cross the wall easily in the first attempt only.
Sample Input 2: 5:1:2:{9,10}
Here Muthooswamy can jump 5 metres height but slides down by 1 metre. He has 2 walls to jump and the height of each wall is 9 and 10 metres respectively.
While crossing the first wall, Muthooswamy takes 2 attempts because during the first attempt he jumps 5 metres but slides down by 1 metre since he didn't cross the wall. In the next attempt he jumps 5 more metres from that position and this time he doesn't slide because he crossed the wall in this attempt because 4+5=9 and 9 metres is the actual height of the wall.
Similarly while crossing the second wall, Muthooswamy takes 3 attempts because during his second attempt on this wall, he slides down by 1 metre since 4+5=9 and the height of the wall is 10 metres. During his third attempt, Muthooswamy was able to escape from ***
Related Tutorials/Questions & Answers:
plz help me any one as fast as u canplz help me any one as
fast as
u can A thief Muthhooswamy planned... is the number of metres he
can jump (1<=climbUp<=10^10)
climbDown...
Sample Input 1: 10:1:1:{10}
Here Muthooswamy
can jump 10 metres height
Any one can help me? - Java BeginnersAny one can help me?
CAN any of
u help me to do this java codes for the interface given below?
thanku
the user will be given jumbled words.... If the player is able to arrange all the words without
any mistake, he/she
can get
Advertisements
could any one help me?could
any one help me? I'm a student in the faculty of computer and information science we will make graduation project "taxi dispatcher" we need to use mobile "x6 nokia" in car and send the coordinate of car through gps which
Can any one please help me in this ,,,,,,, need java code for this ,,,,please anyoneCan any one please
help me in this ,,,,,,, need java code for this ,,,,please anyone The Airport Valet Parking Company (AVP) is a company which provides a convenient medium cost parking solution to users of a local airport. Key
Help me quickly plz??Help me quickly
plz??
Can you
help me to write code quickly this code is a java code take input as double and should use command line arguments and enhanced for statement then find the combine of the numbers
plz help quickly
plz Help me - Java Beginnersplz Help me Hi,
I want learn struts,I dont have
any idea about this
plz help how
can i make a framework.If
u have
any information then
plz send my personal id
plz tell
me that whose software installed.and give
me brief
plz help me for this questionplz help me for this question Apply simplex procedure to solve the L.P.P. maximize z = 3x1 + 4x2 subject to 5x1 + 4x2 â?¤ 200; 3x1 + 5x2 â?¤ 150; 5x1 + 4x2 â?¥ 100; 8x1 + 4x2 â?â?¥ 80, x1 â?¥ 0, x2 â?¥ 0
plz help me - Java Beginnersplz help me Hi,
I want to search all field from database using name, and display in text box, then data is update and delete.
i want to search name using alphabets a-z,
plz reply
fast.
plz help me this is very urgent
plz help me - Java Beginnersplz help me Deepak I
can write a sessioon code
plz help me admin_home.jsp page is display but data is not disply
plz help me what is wrong
Plz Help MePlz Help Me Write a program for traffic light tool to manage time giving between Main-Street and sub-Street. firstly, give green light for 40... traffic light on the frame. We have used java swing. It may
help you.
import
Can u Look to the error plz - Java BeginnersCan u Look to the error plz this is my code
can u modify it
plz and give
me the result of it when
u check it on eclipse or jcreator
plz and i will be more thankfull if
u do that :) , oh yeh
one thing
can you draw a flag
plz help me - Java Beginners is true...but i very confuse that how it is not displayed admin page
plz any one give
me reponse my persinal given id Hi ragni,
i am sending...
plz help me Thanks deepak continue response..i face some problem
i
plz help me!!!!!!!! - JSP-Servletplz help me!!!!!!!! i`ve set the environment varaibles for tomcat... there are compilation errors..
plz do
help me. make sure that you did...)
/AddStudent.java
/lib(If
any jar files required)
/web.xml
plz help me - Java Beginnersplz help me deepak hw
can i create a data grid in jsp and also how
can i connect to the data base
plz help me to create data grid in jsp use html tables with borders.
to connect to data base use scriptlets.
ex
can u plz try this program - Java Beginnerscan u plz try this program Write a small record management application for a school. Tasks will be Add Record, Edit Record, Delete Record, List...)
No database should be used. All data must be stored in
one or two files.
Listing
need the answer vry urgently..plz help me...[plzzzzzzzz...
useing struts or servlet...
in eclipse platform...
can any one tell
me the source......to panda.pragnya7@gmail.com/panda_pragnya@yahoo.com...
plz plz...
help....
me..it
can change my lyfe...need the answer vry urgently..
plz help me...[plzzzzzzzz the question
Intranet Website creation - plz help me Intranet Website creation -
plz help me hi..
I have assign with the intranet website creation work..right from scratch to end..And honestly I know nothing about it.My domain is totally different ..
can anybody pls
help me can any one explain thiscan any one explain this class Clidder {
private final void flipper() {
System.out.println("Clidder");
}
}
public class Ex3 extends Clidder {
public final void flipper() {
System.out.println
facing problem plz help me out - FrameworkFacing problem
plz help me out hi i am new to servlet i deployed... the web.xml file too parallel to the classes folder now i am facing this problem.plz tell
me what to do... error:The requested resource (Servlet servlet
interview question plz help me and thersinterview question
plz help me and thers A college is good... "M.Tech" is
one of the courses offered, it must also offer "B.Tech" and "MCA" courses.
5.If "MBBS" is
one of the courses, it must not offer a "B.Tech" Course
PLZ HELP ME. i need php code. PLZ HELP ME. i need php code. I want php code for bellow OUTPUT.
output is just example but it must be letters only.
abc
bcd
efg
jku
rgt
azs
hje
qqc
wws
adt
help me plz befor 27 februryhelp me plz befor 27 februry what is rung with this ??
help me plzzzz
import java.util.Scanner;
public class Initials
{
public static void main (String [] args)
{
String firstname,lastname
Can someone help me with this?Can someone
help me with this? I have this project and i dont know how to do it.
Can someone
help me? please?
Write a java class named "PAMA..., Multiply, Divide)
Help me please! Thanks in advance!
import
Plz help me with this Question - Java BeginnersPlz help me with this Question this is java code
-------------------------
Consider the following code:
int [ ] a = [1, 2, 3];
Object o ="123";
String t = "12";
String w = t + "3";
Boolean b = o.equals (a);
Boolean b2
help me plz - Java Interview Questionshelp me plz 1)write a java program that prompts the user to input a decimal number and print the number rounded to the nearest integer?
2)write...?
plz answer my question Hi Friend,
Try the following code:
1
can u plz explain the http request methods - JSP-Servletcan u plz explain the http request methods
can u plz explain http... duplicate entries in the MySQL database we
can follow
one of these following approach... we
can execute following query:
Query
CREATE TABLE backup_table AS
SELECT
plz Help me find the correct programs answersplz Help me find the correct programs answers
Create a washing... INDICA" and "TATA NANO" respectively.
Plz mail
me your answers... to the program so as to accept
any type of numeric values and returns the results
plz help me - Java Interview Questionsplz help me 1)Rewrite the method in exercise 10 such that it use...; if the array or sorted , the high-speed binary search
can be used as follow... consists of
one element that is not equal to the search value , i.e. the search
java, plz help me in doing this - Java Beginnersjava,
plz help me in doing this # Write a small record management... Limit). No database should be used. All data must be stored in
one or two files.....giving
me the error of NoClassDefFoundError
plz help me to create gui using Java netbeansplz help me to create gui using Java netbeans Hi,
I am unable to fetch a particular data from DB.I am using netbeans for creating GUI. If I want.... I am unable to fetch the particular data.
Plz help me
Hi Friend
population problem plz help me befor 16 March 2011 !!population problem
plz help me befor 16 March 2011 !! the
Q is :
How
can i count how many years it will take for the population of a town to go over 30.000 .. consider that it Increases 10% every year ??
And this is my code &