Question: geeta wants to cross a river which does not have a brif = dge across it . she found some logs floationg on the waer
geeta wants to cross a river which does not have a brifdge across it she found some logs floationg on the waer and decides to cross the river by jumping from one log to other. She noticed something peculiar about the logs they were all very alippery and someone had tied them together at the left end to hold them parallel to each other Only the right end of th logs was good enough to get some grip so she decided to cross the river by jumping from the right end pf one log to the next However all the logs were of different length ehich meant each jump she had to also go a certain distance left to right
geeta knows she could only jump a fixed distance to her roght and to her left. so if the logs were more apart than would to turn back and reach her styarting position. her first priority was to reach the opposite bank but if left with no choice she would return back to her starting position
write a progrma to print the number of jumps geeta akes before reaching either the opposite end or her starting position
read the input from stdin and print the output to stdout do moyt wrie arbitary strings anywhere in the program
Contarint
n number of logs
xy maximum distance geeta can jump in left and right direction
length of any log
int step neededint n int x int y int a
sample input
n x y
a
output
where a represent length of log
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
