attempt? Question : Christine's Sense of Direction Christine is on a hiking trip to a mountain. She decid is good in canoeing, but not so good with directions where Christine will also start her trip. The river flow into two smaller rivers. Each of these rivers further t before they split. There are towns at the points where the rivers split. splits at town 1. Every town downstream from town (right). Christine knows the location of her town is a certain distance, she realized that she was on the she is currently at town P, how much distance does Note: The rivers only split and never merge. Input Specification input1: M the distance between adjacent towns input2: P the town Christine is at now. input3: Q her home town
program in c++
Answers
Explanation:
Christine is on a hiking trip to a mountain. She decided to return to her town by a canoe.
She is good in canoeing, but not so good with directions. The river originates from the
glacier from where Christine will also start her trip. The river flows a distance M kilometers
before it splits into two smaller rivers. Each of these rivers further travels another M
kilometers distance before they split.
There are towns at the points where the rivers split. The towns are numbered. The river first
splits at town 1. Every town downstream from town v, is numbered 2*v (left) and 2*v+1
(right). Christine knows the location of her town is Q and has started canoeing. After
traveling a certain distance, she realized that she was on the wrong route for the past K
kilometers. If she is currently at town P, how much distance does she have to row now to
reach her town?
Note: The rivers only split and never merge.
Input Specification
input1: M the distance between adjacent towns.
input2: P the town Christine is at now.
input3: Q her home town
Output Specification
The total distance she has to travel to reach her home town.